[Haskell-beginners] Selecting Arguments in Function to Feed Map
Alex Rozenshteyn
rpglover64 at gmail.com
Mon Sep 13 10:01:26 EDT 2010
To actually give the example:
> -- assuming that x and z are defined, and ys is the list
> map (\y -> f x y z) ys
On Mon, Sep 13, 2010 at 9:16 AM, Magnus Therning <magnus at therning.org>wrote:
> On Mon, Sep 13, 2010 at 14:03, Lorenzo Isella <lorenzo.isella at gmail.com>
> wrote:
> > Dear All,
> > Suppose you have the function
> >
> > f x y z = x*y +z
> >
> > and that you want to iterate it on a list
> > z=[1,2,3,4], with
> > x=4 and y=3
> >
> > then you would do the following
> >
> > map (f x y) z.
> >
> > Now consider the case in which the list is given by y e.g.
> >
> > y=[1,2,3,4], with
> > x=4 and z=3.
> >
> > How can you iterate f on y (i.e. its second argument) while keeping x and
> y
> > fixed?
>
> Using a lambda expression (anonymous function) or through clever use of
> flip.
>
> /M
>
> --
> Magnus Therning (OpenPGP: 0xAB4DFBA4)
> magnus＠therning．org Jabber: magnus＠therning．org
> http://therning.org/magnus identi.ca|twitter: magthe
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
--
Alex R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100913/bc84fa9a/attachment.html
More information about the Beginners
mailing list