Hi Paul,
> I actually mentioned the cycle function in my message, and that's what > I was using, but the original question came up because accessing the > nth item in a list takes linear rather than constant time. Apologies for not reading your post carefully. Indeed I think your cyclic-vector solution is great. > I'd be interested to hear how what I was attempting violates the > spirit of clojure. I was trying to work within the bounds of an > existing abstraction, and to implement my changes in such a way as to > not break other things that consume that abstraction. Interop with Java is a real strength of Clojure. But doing so is less useful for learning Clojure and more useful for learning Java. Feel free to pursue it, Java interop is certainly not wasted effort/ knowledge. It certainly doesn't violate the spirit of Clojure, my words were intended in relation to writing Euler solutions in a non- Java way. > Incidentally, I don't believe the error I'm getting from proxy has > anything to do with IPersistentVector being an interface, since you > can clearly do: > > (proxy [clojure.lang.IFn] []) Indeed you can, but you've really just created an empty object: user=> ((proxy [clojure.lang.IFn] [])) java.lang.UnsupportedOperationException: invoke (NO_SOURCE_FILE:0) Now back to IPersistentVector for a moment: This class extends lots of interfaces. There is a name overlap between some of those Interfaces resulting in a very valid error "Duplicate method name&signature". Not a bug with proxy. Regards, Tim. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---