(filter identity foos) and (filter #(not (nil? %)) foos) aren't equivalent.

I prefer (remove nil? foos)  Succint and direct.

On Sun, Aug 12, 2012 at 11:13 PM, Bill Caputo <logos...@gmail.com> wrote:

>
> On Aug 12, 2012, at 12:38 PM, Tamreen Khan wrote:
>
> (filter #(not (nil? %)) coll)
>> (filter identity coll) ;; nearly equal
>>
>
> Is the last one considered generally more readable? I think the following
> is clearer while still not having as much noise as the first filter example:
>
> (filter (partial not nil?) coll)
>
>
> To me it is. I read/heard somewhere that the identity check was idiomatic,
> and started using it to the point where I find myself saying "filter
> identity" as slang for keeping only the valid things.
>
> but that's just me (maybe)... don't know that it is generally considered
> more readable (but I think so).
>
>
> bill
>
>  --
> 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
>

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