Re: Michael newbee challange nr 1

2009-11-09 Thread Meikel Brandmeyer
Hi, On Nov 9, 3:14 pm, Michael Jaaka wrote: > and the other question is if I have (def c [ [ 1 2 ] [ 3 4 ] ]) and want to > get lazily [ 2 4 ] (values of tuplets of a sequence) will be this a correct > (map #(-> % fnext)  c ) way? (map second c) is what you want. This is missing from my soluti

Re: Michael newbee challange nr 1

2009-11-09 Thread Michael Jaaka
By the first I mean this done by Meikel Brandmeyer. However I will check later also this one: "(use '[clojure.contrib.seq-utils :only (partition-by)]) (map (comp callback-fn (fn [part] [(ffirst part) (map second part)])) (partition-by first *s*))" and the other question is if I have (def c [

Re: Michael newbee challange nr 1

2009-11-09 Thread Michael Jaaka
Keys are always sorted. So once a key stops appearing it won't appear again. The first solution seems to be the right one, because all values are processed in a sequence manner in a lazy way. 2009/11/8 DTH > > On Nov 8, 12:33 pm, Michael Jaaka > wrote: > > > > now I would like get such effect t

Re: Michael newbee challange nr 1

2009-11-09 Thread DTH
On Nov 8, 12:33 pm, Michael Jaaka wrote: > > now I would like get such effect that callbackListener will be called twice > for the example collection. > > once with "tom" and iterator (or a lazy seq) to lazy evaluated collection of > (32 and 2333) > and second with "anne" and iterator for collect

Re: Michael newbee challange nr 1

2009-11-08 Thread John Harrop
On Sun, Nov 8, 2009 at 7:33 AM, Michael Jaaka wrote: > Hi! How would you solve such problem: > > I have a collection of pairs (key, value) -> > [ [ "tom" 32 ] [ "tom" 2333 ] [ "anne" 12 ] [ "anne" 55 ] ] > > As you can see keys can occur more than once, also that collection is very > large so it

Re: Michael newbee challange nr 1

2009-11-08 Thread Meikel Brandmeyer
Hi, Am 08.11.2009 um 13:33 schrieb Michael Jaaka: > Hi! How would you solve such problem: > > I have a collection of pairs (key, value) -> > [ [ "tom" 32 ] [ "tom" 2333 ] [ "anne" 12 ] [ "anne" 55 ] ] > > As you can see keys can occur more than once, also that collection > is very large so it

Michael newbee challange nr 1

2009-11-08 Thread Michael Jaaka
Hi! How would you solve such problem: I have a collection of pairs (key, value) -> [ [ "tom" 32 ] [ "tom" 2333 ] [ "anne" 12 ] [ "anne" 55 ] ] As you can see keys can occur more than once, also that collection is very large so it should be evaluated lazily (for example the collection cames from