user=> (defn tweek* [knob] (tweek knob)) #'user/tweek* user=> (tweek* base) Tweeked base nil user=> (deftype Box [& knobs] Tune (tweek [this] (for [knob knobs] (tweek* knob)))) user.Box user=> (tweek (Box. base treble)) #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: user.Knob>
Not lexical scope, then -- it's not the deftype macro redefining it lexically or that wouldn't make tweek* stop working. user=> (defn tweek* [knobs] (pmap #(tweek %) knobs)) #'user/tweek* user=> (tweek (Box. base treble)) #<CompilerException java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: user.Knob (NO_SOURCE_FILE:28)> Even more interesting. It's not being thread-locally rebound, either. It's being globally rebound. user=> (deftype Box [& knobs] Tune (tweek [this] (println this) (tweek* knobs))) user.Box user=> (tweek (Box. base treble)) #<Box user....@fe7f80> #<CompilerException java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: user.Knob (NO_SOURCE_FILE:30)> Fascinating. It's not calling the Box tweek on the Box, then calling the Box tweek again on the knobs, else we'd have seen #<Box user....@fe7f80> #<Knob user.k...@fa6824> #<CompilerException java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: user.Knob as it called tweek on the Box, printed the box, called tweek* which mapped over the knobs, tweek got called on the base knob, printed the base knob, and then tried to pmap over the base knob which isn't an ISeq. It's doing something else but I don't know what and I've got to go, sorry. Fringe is on. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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