
31 Jan
2007
31 Jan
'07
6:22 p.m.
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