[Haskell-beginners] Is this overkill?

Felipe Lessa felipe.lessa at gmail.com
Fri Apr 3 22:16:30 EDT 2009


On Fri, Apr 03, 2009 at 08:58:41PM -0500, Zachary Turner wrote:
> trueIndices = curry $ map fst . filter snd . zip [0..] . map (uncurry (&&))
> . (uncurry zip)

Just some tips: note that

  map (uncurry f) . zip  ===  zipWith f
  curry $ f . uncurry g  ===  (f .) . g

so

  trueIndices = ((map fst . filter snd . zip [0..]) .) . zipWith (&&)

There must be some combinators to avoid the '((...) .) .' thing, though. I just don't remember :).

HTH,

--
Felipe.


More information about the Beginners mailing list