Another way to do it, using 'reductions':

(rest (reductions conj [] a1))

On Wednesday, November 9, 2011 5:47:08 PM UTC-5, Shoeb Bhinderwala wrote:
>
> Is there a more elegant/idomatic way to achieve the following result: 
>
> user=> a1 
> ["a" "b" "c" "d"] 
>
> user=> (map-indexed (fn [n x] (vec (take (inc n) x))) (take (count a1) 
> (repeat a1))) 
> (["a"] ["a" "b"] ["a" "b" "c"] ["a" "b" "c" "d"]) 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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