[Haskell-beginners] \x -> x < 0.5 && x > -0.5
magnus at therning.org
Mon Oct 19 05:03:50 EDT 2009
On Mon, Oct 19, 2009 at 9:49 AM, Michael Mossey <mpm at alumni.caltech.edu> 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.
Using &&& from Control.Arrow you can write something like
file (uncurry (&&) . ((< 0.5) &&& (> -0.5))) xs
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus＠therning．org Jabber: magnus＠therning．org
http://therning.org/magnus identi.ca|twitter: magthe
More information about the Beginners