Arc Forumnew | comments | leaders | submitlogin
2 points by varbanov 4605 days ago | link | parent

There's short Jarc documentation on http://jarc.sourceforge.net/ Calling Java from Jarc works nice, as described. I've used this in several occasions.

varbanov



1 point by jsgrahamus 4605 days ago | link

Thanks.

BTW, I found some blog posts about Jarc and tried an example which yielded an error. Any thoughts on this?

  Jarc> (map 'getTime '(list (new java.util.Date)))
  Can't find method: jarc.Symbol.list()
  (stdin):1: Error: Can't apply function: getTime

  0: (map (quote getTime) (quote (list (new java.util.Date))))
  DEBUG 0:

-----

2 points by rocketnia 4605 days ago | link

I think that quote is just a typo. Try (map 'getTime (list (new java.util.Date))).

-----

1 point by jsgrahamus 4605 days ago | link

  Jarc> (map 'getTime (list (new java.util.Date))).
  (stdin):2: Error: Can't apply function: getTime

  0:      (map (quote getTime) (list (new java.util.Date)))
  DEBUG 0: Unknown command: .
  0:      (map (quote getTime) (list (new java.util.Date)))
  DEBUG 0: r 13
  13

  ---

  Jarc> (map 'getTime (list (new java.util.Date)))
  (stdin):4: Error: Can't apply function: getTime

  0:      (map (quote getTime) (list (new java.util.Date)))
  DEBUG 0: r 13
  13

  ---

  Jarc> (map 'getTime (new java.util.Date))
  (stdin):6: Error: Type-error:
  Tue May 15 12:02:40 MDT 2012 is not of type LIST

  0:      (map (quote getTime) (new java.util.Date))
  DEBUG 0: r 13
  13

  ---

  Jarc>

-----

1 point by rocketnia 4605 days ago | link

First error: You included a spurious . at the end. (You caught this.)

Third error: The sequence you passed to 'map was a java.util.Date, not a string or list like 'map expects.

Second error: Now that seems weird.

I can't help much at this time of day, but what happens when you say "(getTime:new java.util.Date)" and "(idfn!getTime:new java.util.Date)"?

-----

1 point by jsgrahamus 4605 days ago | link

  Jarc> (getTime:new java.util.Date)
  1337107797339

  Jarc> (idfn!getTime:new java.util.Date)
  1337107814529

  Jarc>
Thanks.

-----

1 point by rocketnia 4605 days ago | link

Oh, now that we're talking about it, I seem to remember there's some kind of issue where Jarc allows regular function calls on symbols but 'apply on a symbol doesn't work. So how about (apply 'getTime (list:new java.util.Date))?

-----

1 point by jsgrahamus 4605 days ago | link

  Jarc> (apply 'getTime (list:new java.util.Date))
  1337113306091
  Jarc>

-----

2 points by varbanov 4604 days ago | link

I guess there's an issue here because getTime is not a "regular" arc function, but a Java method and the mapping from names to methods is not "hooked" in map implementation (I guess :) ...

Anyway the following works:

Jarc> (map (fn (_) (getTime _)) (list (new java.util.Date)))

(1337177450156)

-----