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.
As a dialog in the Quackery shell (REPL).
 
<lang Quackery>/O> [ 3 ** ] is cubed ( n --> n )
<pre>/O> ' [ ]
...
 
Stack empty.
 
/O> []
... ' [ 1 2 3 4 5 6 7 8 9 10 ]
... witheach [ 3 ** join ]
... [ cubed join ]
...
 
Stack: [ 1 8 27 64 125 216 343 512 729 1000 ]
 
</pre>
/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}}==
1,462

edits