
19 Oct
2009
19 Oct
'09
6:02 a.m.
Michael Mossey wrote:
Is there a nifty way to write
filter (\x -> x < 0.5 && x > -0.5) xs
without explicitly using x?
Maybe arrows? I have a vague understanding that arrows can "send" an argument to more than one computation.
That's a job for the reader monad. Lambda Fu, form 53 - silent reader of truth import Control.Monad import Control.Monad.Reader filter (liftM2 (&&) (< 0.5) (> -0.5)) xs Regards, apfelmus -- http://apfelmus.nfshost.com