Partial function application: Difference between revisions

Added 11l
(Added 11l)
Line 32:
* This task is more about ''how'' results are generated rather than just getting results.
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>F partial(f, g)
F fg(x)
R @f(@g, x)
R fg
 
F main()
F ffs(f, x)
R x.map(a -> @f(a))
F f1(a) {R a * 2}
F f2(a) {R a * a}
 
V fsf1 = partial(ffs, f1)
V fsf2 = partial(ffs, f2)
 
print(fsf1([1, 2, 3, 4]))
print(fsf2([1, 2, 3, 4]))
 
main()</lang>
 
{{out}}
<pre>
[2, 4, 6, 8]
[1, 4, 9, 16]
</pre>
 
=={{header|Ada}}==
1,481

edits