[Haskell-cafe] Re: A function that makes list of Bool lists from list of Int lists

TeXitoi texitoi at texitoi.eu
Sun Apr 4 10:56:49 EDT 2010

Alexandru Scvortov <scvalex at gmail.com> writes:

> Too many points.
> listbool :: [[a]] -> [[Bool]]
> listbool = zipWith ($) (map (map . const) (cycle [True, False]))

If we choose to zipWith ($), maybe this will do a little less work :

  listbool = zipWith ($) (cycle $ map (map . const) [True, False])

(ie cycle the 2-element-list of function and not the bool list and
then map on an infinite list)

Guillaume Pinot               http://www.irccyn.ec-nantes.fr/~pinot/

« Les grandes personnes ne comprennent jamais rien toutes seules, et
c'est fatigant, pour les enfants, de toujours leur donner des
explications... » -- Antoine de Saint-Exupéry, Le Petit Prince

()  ASCII ribbon campaign      -- Against HTML e-mail
/\  http://www.asciiribbon.org -- Against proprietary attachments

More information about the Haskell-Cafe mailing list