Apply a callback to an array: Difference between revisions
→{{header|Quackery}}: added an array-like method.
(Added Quackery.) |
(→{{header|Quackery}}: added an array-like method.) |
||
Line 2,514:
=={{header|Quackery}}==
As a dialogue in the Quackery shell (REPL), applying the word <code>cubed</code> to the nest <code>[ 1 2 3 4 5 6 7 8 9 10 ]</code>, first treating the nest as a list, then as an array.
<lang Quackery>/O> [ 3 ** ] is cubed ( n --> n )
...
Stack empty.
/O> []
... ' [ 1 2 3 4 5 6 7 8 9 10 ]
... witheach
... [ cubed join ]
...
Stack: [ 1 8 27 64 125 216 343 512 729 1000 ]
/O> drop
... ' [ 1 2 3 4 5 6 7 8 9 10 ]
... dup witheach
... [ cubed swap i^ poke ]
...
Stack: [ 1 8 27 64 125 216 343 512 729 1000 ]</lang>
=={{header|R}}==
|