I was playing around with some project euler problems, and I was
thinking that the cycle function has an analog for vectors. I
implemented a short simple method with the right behavior (at a simple
surface level):

(defn cyclic-vector [v]
  (fn [x]
    (v (mod x (count v)))))

However, this obviously does not implement IPersistentVector.

Is there any easy way to implement something like this, and delegate
the rest of the behaviors to the base vector object ? I realize this
is probably possible with proxy, but I have not successfully made it
work yet - proxying the IPersistentVector interface results in the
following for me:

(proxy [clojure.lang.IPersistentVector] [])

java.lang.ClassFormatError: Duplicate method name&signature in class
file clojure/proxy/java/lang/Object$IPersistentVector (NO_SOURCE_FILE:
2)

Is this an issue with proxy, or am I using it incorrectly ? I removed
any extraneous code of my own, since the error occurs with just the
minimal proxy usage shown above. I'm on trunk, revision 1326.


--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to