> but, I can't seem to do this with the 'inc' function:
>
> user=> (binding [inc (fn [y] (+ 2 y))] (inc 44))
> 45
>
> Why doesn't this work?

Because inc is inlined, and thus isn't mentioned when your binding  
occurs.

(defn inc
   "Returns a number one greater than num."
   {:inline (fn [x] `(. clojure.lang.Numbers (inc ~x)))}
   [x] (. clojure.lang.Numbers (inc x)))

Try this:

user=> (binding [inc (fn [y] (+ 2 y))] (apply inc [44]))
46

-- 
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

Reply via email to