Thanks everybody, Clojure community is awesome .. and also I just wanted to learn to use lazy-seq that is why it was written in the way I showed you all.
Thanks again. Sunil. On Thu, Nov 25, 2010 at 11:26 AM, Ken Wesson <kwess...@gmail.com> wrote: > Eh. This is weird. It seems that (partition n coll) drops the last > part of coll if it's not a multiple of n in size; e.g. (partition 3 [1 > 2 3 4 5]) yields ((1 2 3)) and not ((1 2 3) (4 5)). (partition n n [] > coll) does do that though. > > OTOH, > > (mapcat identity (partition 1 n coll)) > (apply concat (partition 1 n coll)) > (keep-indexed (fn [i x] (if (= 0 (rem i n)) x)) coll) > (map first (partition-all n coll)) > (mapcat identity (partition-all n coll)) > (apply concat (partition-all n coll)) > > and the winner is: > > (flatten (partition 1 n coll)) > > Only 30 characters. :) > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- 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