On Fri, Nov 28, 2008 at 2:33 AM, Eric Sessoms <[EMAIL PROTECTED]> wrote:
>
> For kicks, I've uploaded a little wrapper around JInterface to make it
> a little more lispy.  It might make it a little easier for anyone
> interested in playing around with that option.
>
> http://clojure.googlegroups.com/web/erlang.clj

Interesting :)

> ;;; erlang.clj -- Clojure wrapper for Erlang's JInterface.
>
> (ns erlang)
>
> ;; YMMV
> (add-classpath 
> "file:///opt/local/lib/erlang/lib/jinterface-1.4/priv/OtpErlang.jar")

Using add-classpath, except at the REPL, is discouraged.

[...]
> ;; atom
> (defmethod to-erlang clojure.lang.Symbol [s]
>   (new OtpErlangAtom (str s)))
>
> (defmethod from-erlang OtpErlangAtom [s]
>   (symbol (.atomValue s)))
>
> (defmethod to-erlang clojure.lang.Keyword [s]
>   (new OtpErlangAtom (subs (str s) 1)))
[...]

I think you want (name s) for both the Symbol and Keyword cases:

user=> (defmulti to-erlang class)
#'user/to-erlang
user=> (defmethod to-erlang clojure.lang.Symbol [s] (name s))
#<MultiFn [EMAIL PROTECTED]>
user=> (defmethod to-erlang clojure.lang.Keyword [s] (name s))
#<MultiFn [EMAIL PROTECTED]>
user=> (to-erlang 'symbol)
"symbol"
user=> (to-erlang :keyword)
"keyword"

-- 
Michael Wood <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to