On Jul 14, 10:04 pm, bgray <[email protected]> wrote:
> I'm not sure if this is a binding issue or not.
>
> user=> (def a 1)
> #'user/a
> user=> (binding [a 3] (filter #(= % a) '(1 2 3)))
> (1)
> user=>
>
> In this case, I was expecting a list with 3 in it.

This is a common gotcha. It's actually a laziness issue: the seq
produced by filter is realised only after it exits the binding scope,
thus producing '(1). You need to use "doall" to force the seq if you
want the binding to apply.

--
Jarkko

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to