[erlang-questions] Second order function lists:map
Thu Mar 12 09:59:12 CET 2009
On Mar 10, 2009, at 11:42pm, Richard O'Keefe wrote:
> On 11 Mar 2009, at 3:56 am, Franco Milicchio wrote:
>> The second one is tricky to me (I am not an erlang guru!). I want
>> its "dual", so given a list of functions, I'd like to map them to a
>> single argument, writing a second-order function like the above
>> p:paa/1. The only problem is that I am stopped by this problem, I
>> know it's easy but I am not that good at functional programming :)
> 1. map(F, L) -> [F(X) | X <- L].
> paa(F) -> fun (L) -> map(F, L) end.
> 2. pam(L, X) -> [F(X) | F <- L].
> aap(L) -> fun (X) -> pam(L, X) end.
> See the parallels?
Now I see! Thanks to all of you, you're really handy!
Franco Milicchio <>
DIA - Dept. of Computer Science and Engineering
University Roma Tre
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2435 bytes
Desc: not available
More information about the erlang-questions