First-class functions/Use numbers analogously: Difference between revisions
Content added Content deleted
Line 249: | Line 249: | ||
(3 multiplier B) 4 |
(3 multiplier B) 4 |
||
6 3 2</lang> |
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}}== |
=={{header|OCaml}}== |