First-class functions/Use numbers analogously: Difference between revisions
First-class functions/Use numbers analogously (view source)
Revision as of 17:15, 19 August 2010
, 13 years agorewrite with an attempted understanding of the new problem statement
(→{{header|D}}: Marked incorrect. Compare and contrast the resultant program with the corresponding entry in First-class functions.) |
(rewrite with an attempted understanding of the new problem statement) |
||
Line 229:
=={{header|J}}==
This seems to satisfy the
<lang j> x
xi =: 0.5
y =: 4.0
yi =: 0.25
z =: x + y
zi =: 1.0 % ( x + y )
A=: x,y,z
<lang j> 2 multiplier 0.5 (4)▼
B=: %A
0.5 multiplier 4 (0.25)▼
4 multiplier 0.25 (2+4)▼
2</lang>▼
Example use:
▲<lang j> multiplier=: conjunction def '(m * n) * ]'</lang>
<lang> BA 1
1 1 1
4 8 12
▲6 3 2</lang>
=={{header|OCaml}}==
|