[Haskell-cafe] Re: Tips of Conditional Expression

Daniel Fischer daniel.is.fischer at web.de
Fri Feb 22 09:43:30 EST 2008


Am Freitag, 22. Februar 2008 15:22 schrieb TOPE KAREM:
> Thanks. My question is whether it can call a function (say map) previously
> defined elsewhere in the program. Same goes for filter.
>
> Tope

Like

oddlyMakeEven [] = []
oddlyMakeEven ks@(k:_) = if odd k then map (*2) ks else filter even ks

?
Sure, each branch can be an arbitrarily complex expression.

HTH,
Daniel


More information about the Haskell-Cafe mailing list