Or my current favorite take-while iterate combo:

C:\clojure-1.2.0>java -jar clojure.jar
Clojure 1.2.0
user=> (take-while seq (iterate rest [1 2 3 4]))
([1 2 3 4] (2 3 4) (3 4) (4))

user=> (take-while seq (iterate butlast [1 2 3 4]))
([1 2 3 4] (1 2 3) (1 2) (1))
user=>

On Nov 9, 4:52 pm, Alex Baranosky <alexander.barano...@gmail.com>
wrote:
> Dang,
> I just logged in in-flight just so I could post my solution with reductions
> :)
>
> (defn doit [coll]
>   (rest (reductions conj [] coll)))

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