Re: [Haskell-cafe] timing question

2008-08-05 Thread Arie Groeneveld
Thanks for all the advises so far. Ok, here's my monster that need to be timed in order to make a comparison: (it's about the control digit of SEDOL numbers http://en.wikipedia.org/wiki/SEDOL ): knip _ [] = Nothing knip k xs = Just (splitAt k xs) ip xs = sum . zipWith (*) xs an =

Re: [Haskell-cafe] timing question

2008-08-05 Thread Arie Groeneveld
Acc. to Luke Palmers suggestion this will be the right answer? *Main seqList rwhnf(map f $ concat.replicate 100 $ unfoldr (knip 6) an) () (3.46 secs, 834240864 bytes) or with/without list construction *Main let ry = concat.replicate 100 $ unfoldr (knip 6) an (0.00 secs, 0 bytes) *Main

[Haskell-cafe] timing question

2008-08-03 Thread Arie Groeneveld
Suppose I've: f = map g I want to know how much time it takes (interpreted mode) to fully process list xs (at least 1e6 elements) with function g. Is it sufficient to execute: *Main last . f $ xs result (x.xx secs, yyy bytes) Are there any hidden difficulties involved? Reason is:

Re: [Haskell-cafe] timing question

2008-08-03 Thread Arie Groeneveld
Sorry, should go the forum. Ok, thanks. In this case the list consists of 6-digit alphanumeric codes. So doing something like: foldl1 (\x y - g y) xs will do the job? =@@i Bulat Ziganshin schreef: Hello Arie, Sunday, August 3, 2008, 1:56:43 PM, you wrote: *Main last . f $ xs this way

Re: [Haskell-cafe] timing question

2008-08-03 Thread Bulat Ziganshin
Hello Arie, Sunday, August 3, 2008, 1:56:43 PM, you wrote: *Main last . f $ xs this way you will get only spin of list computed, not elements itself. something like sum should be used instead -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re: [Haskell-cafe] timing question

2008-08-03 Thread Brad Larsen
Arie, foldl1 is not strict in its function argument. Using it will cause stack overflows for large lists. For example: GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude foldl1 (+) [0..100] *** Exception: stack overflow

Re: [Haskell-cafe] timing question

2008-08-03 Thread Luke Palmer
On Sun, Aug 3, 2008 at 11:06 AM, Arie Groeneveld [EMAIL PROTECTED] wrote: Sorry, should go the forum. Ok, thanks. In this case the list consists of 6-digit alphanumeric codes. So doing something like: foldl1 (\x y - g y) xs No, that still doesn't force elements. Let's say g is (+1): f =

Re: [Haskell-cafe] timing question

2008-08-03 Thread Don Stewart
bradypus: Suppose I've: f = map g I want to know how much time it takes (interpreted mode) to fully process list xs (at least 1e6 elements) with function g. Is it sufficient to execute: *Main last . f $ xs result (x.xx secs, yyy bytes) Are there any hidden difficulties