Pixel wrote:

> i ended up with this one:
>
> dwBool predicate l = (foldr combine (\_ -> []) l) True
>     where
>       combine e fl beg = if beg && predicate e
>                          then fl True
>                          else e : fl False
>
> higher-order, like solutions 3 & 4, but simpler IMO :p

This looks more like solution 1 to me. The only real difference is that
you use 'Bool -> a' to keep track of the two intermediate results, where
solution 1 uses the isomorphic '(a,a)'.

Nice exercise!


Kind regards,

Arie

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to