On Dec 24, 6:01 pm, Richard Newman <holyg...@gmail.com> wrote:
> > 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.

Thanks Richard....that's one I hadn't thought of.


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

Actually, I think shadowing core functions is not a great idea
but I wanted to understand the principles involved here. Thanks
again for your rapid help.
      cheers,
      -tom

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