"listProduct" -- is this a standard function?

Derek Elkins ddarius at hotpop.com
Wed Oct 15 21:31:24 EDT 2003


On Wed, 15 Oct 2003 17:07:00 +0100
Graham Klyne <gk at ninebynine.org> wrote:

> [[
> lp []       = [[]]
> lp (as:ass) = concatMap (\a -> (map (a:) (lp ass))) as
> ]]
> 
> I think I should also be able to eliminate the lambda-abstraction, but
> I can't see how.  I prefer the list comprehension, as I find that
> easier to read than the \-expression.

lp (as:ass) = concatMap (flip map (lp ass) . (:)) as
but better,
lp = sequence



More information about the Haskell-Cafe mailing list