
25 Mar
2009
25 Mar
'09
1:17 a.m.
On Tue, Mar 24, 2009 at 10:29:55PM +0300, Miguel Mitrofanov wrote:
Maybe it's just me, but I think that
takeList ns xs = evalState (mapM (State . splitAt) ns) xs
or even
takeList = evalState . map (State . splitAt)
would be much clearer than both versions.
I love it! It wouldn't occur to me to utilize State like this (too used to thinking of it as a black box rather than whats inside of it). quite a lot of useful information to learn can be expressed in a line of haskell. sort of like a zen koan. :) John -- John Meacham - ⑆repetae.net⑆john⑈