Anonymous user
First-class functions/Use numbers analogously: Difference between revisions
First-class functions/Use numbers analogously (view source)
Revision as of 09:03, 26 August 2010
, 13 years ago→{{header|Mathematica}}
Line 249:
(3 multiplier B) 4
6 3 2</lang>
=={{header|Mathematica}}==
<lang Mathematica>f[x_, y_] := x*y*# &
f[a, b]
x = 2; xi = 0.5; y = 4; yi = 0.25; z = x + y; zi = 1/(x + y);
f[x, xi][0.5]
f[y, yi][0.5]
f[z, zi][0.5]</lang>
For example:
<pre>a b #1 &
0.5
0.5
0.5</pre>
=={{header|OCaml}}==
|