Apply a callback to an array: Difference between revisions

(Added Yacas)
Line 1,650:
 
(The function <tt>f</tt> can be rewritten so that it can accept vectors as argument simply changing operators to their dot ''relatives'': <code>e = x.^2 + exp(-1 ./ (y.+1))</code>)
 
=={{header|Oforth}}==
apply allows to perform a function on all elements of a list :
<lang Oforth>[ 1, 2, 3, 4, 5 ] apply(#[ print " " print ])</lang>
 
map regroups all results into a new list :
<lang Oforth>[ 1, 2, 3, 4, 5 ] map(#sq)</lang>
 
=={{header|ooRexx}}==
1,015

edits