Jump to content

First-class functions/Use numbers analogously: Difference between revisions

Added 11l
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(Added 11l)
Line 22:
<small>To paraphrase the task description: Do what was done before, but with numbers rather than functions</small>
<br><br>
 
=={{header|11l}}==
{{trans|Python}}
 
<lang 11l>V (x, xi, y, yi) = (2.0, 0.5, 4.0, 0.25)
V z = x + y
V zi = 1.0 / (x + y)
V multiplier = (n1, n2) -> (m -> @=n1 * @=n2 * m)
V numlist = [x, y, z]
V numlisti = [xi, yi, zi]
print(zip(numlist, numlisti).map((n, inversen) -> multiplier(inversen, n)(.5)))</lang>
 
{{out}}
<pre>
[0.5, 0.5, 0.5]
</pre>
 
=={{header|Ada}}==
1,480

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.