Apply a callback to an array: Difference between revisions
Content added Content deleted
(add zsh) |
|||
Line 1,222: | Line 1,222: | ||
If F takes 2 arguments, x and , then simply pass them to map. They will be passed to F when as it is applied to each element of A. |
If F takes 2 arguments, x and , then simply pass them to map. They will be passed to F when as it is applied to each element of A. |
||
<lang vorpal>A.map(F, x, y)</lang> |
<lang vorpal>A.map(F, x, y)</lang> |
||
=={{header|Zsh}}== |
|||
<lang zsh>map(){for i ($*[2,-1]) $1 $i} |
|||
a=(1 2 3) |
|||
map print $a</lang> |
|||
{{omit from|gnuplot}} |
{{omit from|gnuplot}} |