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

added Arturo
(→‎{{header|jq}}: transpose)
(added Arturo)
Line 108:
The First Class Functions example uses C. H. Lindsey's partial parameterization extension to Algol 68 which implemented in Algol 68G but not in algol68toc.
This example uses an alternative (technically, invalid Algol 68 as the author notes) accepted by algol68toc but not Algol 68G.
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">x: 2.0
xi: 0.5
y: 4.0
yi: 0.25
z: x + y
zi: 1 / z
 
multiplier: function [m n][
function [a] with [m n][
a*m*n
]
]
 
couple @[x y z] @[xi yi zi]
| map 'p -> multiplier p\0 p\1
| map => [call & -> 0.5]
| print</syntaxhighlight>
 
{{out}}
 
<pre>0.5 0.5 0.5</pre>
 
=={{header|Axiom}}==
1,532

edits