Apply a callback to an array: Difference between revisions

Content added Content deleted
No edit summary
(→‎{{header|Insitux}}: implementation)
Line 1,693: Line 1,693:


will yield a scalar if <tt>a</tt> is scalar or a vector if <tt>a</tt> is a vector or an n-dimensional array if <tt>a</tt> is an n-dimensional array
will yield a scalar if <tt>a</tt> is scalar or a vector if <tt>a</tt> is a vector or an n-dimensional array if <tt>a</tt> is an n-dimensional array

=={{header|Insitux}}==

<syntaxhighlight lang="insitux">; apply a named function
(map inc [1 2 3 4])</syntaxhighlight>

<syntaxhighlight lang="insitux">; apply a parameterised closure
(map (fn x (+ x 1)) [1 2 3 4])</syntaxhighlight>

<syntaxhighlight lang="insitux">; apply a non-parameterised closure
(map #(+ % 1) [1 2 3 4])</syntaxhighlight>

<syntaxhighlight lang="insitux">; apply an explicit partial closure
(map @(+ 1) [1 2 3 4])</syntaxhighlight>

<syntaxhighlight lang="insitux">; apply an implicit partial closure
(map (+ 1) [1 2 3 4])</syntaxhighlight>


=={{header|Io}}==
=={{header|Io}}==