Re: Flatten a list

2009-02-25 Thread Jeffrey Straszheim
I always end up doing (filter identity '(:fred :mary nil :sue)) (remove nil? ...) is actually more clear. I'll try to remember that. On Tue, Feb 24, 2009 at 10:42 PM, Timothy Pratley wrote: > > user=> (remove nil? '(:a nil nil :b :a)) > (:a :b :a) > > On Feb 25, 2:38 pm, Sean wrote: > > I've go

Re: Flatten a list

2009-02-24 Thread Sean
On Feb 24, 11:35 pm, David Sletten wrote: > On Feb 24, 2009, at 6:07 PM, David Sletten wrote: > > > > > (defn kill-nil > >    ([l] (kill-nil l '())) > >    ([l result] (cond (nil? l) (reverse result) > >                      (nil? (first l)) (recur (rest l) result) > >                      true

Re: Flatten a list

2009-02-24 Thread David Sletten
On Feb 24, 2009, at 6:07 PM, David Sletten wrote: > > (defn kill-nil >([l] (kill-nil l '())) >([l result] (cond (nil? l) (reverse result) > (nil? (first l)) (recur (rest l) result) > true (recur (rest l) (cons (first l) result ) > > I forgot

Re: Flatten a list

2009-02-24 Thread David Sletten
On Feb 24, 2009, at 5:42 PM, Timothy Pratley wrote: > > user=> (remove nil? '(:a nil nil :b :a)) > (:a :b :a) > > C'mon! Doesn't anybody do things the old-fashioned way anymore? (defn kill-nil ([l] (kill-nil l '())) ([l result] (cond (nil? l) (reverse result) (nil? (

Re: Flatten a list

2009-02-24 Thread Sean
Awesome! Thanks guys! On Feb 24, 10:42 pm, Timothy Pratley wrote: > user=> (remove nil? '(:a nil nil :b :a)) > (:a :b :a) > > On Feb 25, 2:38 pm, Sean wrote: > > > I've got the following list > > > (:a nil nil :b :a) > > > I want to call a "nil-killer" function, and get the following list > >

Re: Flatten a list

2009-02-24 Thread Timothy Pratley
user=> (remove nil? '(:a nil nil :b :a)) (:a :b :a) On Feb 25, 2:38 pm, Sean wrote: > I've got the following list > > (:a nil nil :b :a) > > I want to call a "nil-killer" function, and get the following list > > (:a :b :a) > > How do I go about this?  Could someone post a quick example? --~--~--

Re: Flatten a list

2009-02-24 Thread Kevin Downey
filter, http://clojure.org/api#filter On Tue, Feb 24, 2009 at 7:38 PM, Sean wrote: > > I've got the following list > > (:a nil nil :b :a) > > I want to call a "nil-killer" function, and get the following list > > (:a :b :a) > > How do I go about this?  Could someone post a quick example? > > >

Flatten a list

2009-02-24 Thread Sean
I've got the following list (:a nil nil :b :a) I want to call a "nil-killer" function, and get the following list (:a :b :a) How do I go about this? Could someone post a quick example? --~--~-~--~~~---~--~~ You received this message because you are subscribed t