On Fri, Dec 24, 2010 at 8:38 PM, Glen Rubin <rubing...@gmail.com> wrote:
> Can I do the following without using loops??
>
> I have list, e.g.
>
> '(4 6 66 33 26 6 83 5)
>
> I want to partition it so that I get a subset of lists that build up
> to the original:
>
> ( (4) (4 6) (4 6 66) (4 6 66 33) ....)

(defn sublists [s]
  (map #(take (inc %) s) (range (count s))))

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