Higher-order functions: Difference between revisions
Content added Content deleted
m (→{{header|Joy}}) |
|||
Line 1,800: | Line 1,800: | ||
This example is taken from V. |
This example is taken from V. |
||
Define first as multiplying two numbers on the stack. |
Define first as multiplying two numbers on the stack. |
||
< |
<syntaxhighlight lang=Joy>DEFINE first == *.</syntaxhighlight> |
||
There will be a warning about overwriting builtin first. |
There will be a warning about overwriting builtin first. |
||
Define second as interpreting the passed quotation on the stack. |
Define second as interpreting the passed quotation on the stack. |
||
< |
<syntaxhighlight lang=Joy>DEFINE second == i.</syntaxhighlight> |
||
Pass first enclosed in quotes to second |
Pass first enclosed in quotes to second. |
||
<lang |
<syntaxhighlight lang=Joy>2 3 [first] second.</syntaxhighlight> |
||
The program prints 6. |
The program prints 6. |
||