[Haskell-beginners] Is this overkill?

Zachary Turner divisortheory at gmail.com
Fri Apr 3 21:58:41 EDT 2009


I thought I would try to see if it were possible to write, in point-free
form using no lambda functions and no intermediate functions, a function
that takes 2 lists of Booleans, computes the pairwise logical AND of the two
lists, and returns a list containing the 0 based indices of the elements
where the logical and of the two was true.  I know that at some point it
becomes overkill and for the sake of readability one should know when to
draw the line.  So I want to see if someone with more experience than me can
comment on whether or not this is over the line :P

trueIndices = curry $ map fst . filter snd . zip [0..] . map (uncurry (&&))
. (uncurry zip)

So do all the uncurries and curries make it too hard to understand or is it
pretty easy to read this?  For me it takes me a while to figure out by
looking at it because it's hard to trace all the currying and uncurrying.
And is there a more elegant solution?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090403/4a7bc302/attachment.htm


More information about the Beginners mailing list