On Oct 22, 6:45 pm, Chouser <[EMAIL PROTECTED]> wrote:
> Don't dismiss clojure/zip to easily. The functions defined there
> largely defer to functions stored in metadata on the object. This
> means a new type of zip tree can be provided by anyone in any
> namespace, simply by returning an object with the appropriate
> metadata.
That looks pretty smart indeed...
This leads me to a more down-to-earth question: what is the right way
to use clojure/zip in a program? First I tried
(use 'clojure.zip)
but this complains about "replace" which exists already in the clojure
namespace. After studying the doc, I decided to try renaming:
(use 'clojure.zip :verbose :rename '{replace zip-replace})
This leads to an error message that I don't understand at all:
user=> java.lang.ClassCastException: java.lang.Boolean
java.lang.ClassCastException: java.lang.Boolean
at clojure.refer__1051.doInvoke(boot.clj:1969)
at clojure.lang.RestFn.applyTo(RestFn.java:144)
at clojure.apply__135.doInvoke(boot.clj:364)
...
Who is casting which Boolean to what there? And, more importantly,
what do I need to fix in my code line?
> In order to implement Java interfaces such that clojure/seq and such
> builtin functions work, you do need to implement a Java class. This
> can be done with 100% Java code by gen-class and possibly the
> easier-to-use proxy function.
Proxy looks useful indeed, thanks!
Konrad.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---