On Oct 16, 2008, at 3:26 PM, Paul Stadig wrote:

> OK. Then next question.
>
> Is there some reason we don't have a "remove the nils" function in  
> the 'clojure namespace?
>
> Something like (filter #(identity %) coll) works, but would it be  
> possible to add a 'squeeze or 'compact function so we could do  
> something like (apply max (compact coll))?


#(identity %) is more compactly written as: identity.

This works:

        user=> (apply max (filter identity '(1 2 nil 4)))
        4

In this case, number? is also a good predicate to use:

        user=> (apply max (filter number? '(1 2 nil 4)))
        4

--Steve


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