Apply a callback to an array: Difference between revisions

Content added Content deleted
(→‎{{header|PowerShell}}: re-inserted PurBasic solution)
Line 1,017: Line 1,017:
$a | ForEach-Object $s
$a | ForEach-Object $s
}</lang>
}</lang>

=={{header|Prolog}}==
Prolog doesn't have arrays, but we can do it with lists. This can be done in the console mode.
<lang Prolog> ?- assert((fun(X, Y) :- Y is 2 * X)).
true.

?- maplist(fun, [1,2,3,4,5], L).
L = [2,4,6,8,10].
</lang>


=={{header|PureBasic}}==
=={{header|PureBasic}}==