Jump to content

Apply a callback to an array: Difference between revisions

(→‎{{header|PowerShell}}: re-inserted PurBasic solution)
Line 1,017:
$a | ForEach-Object $s
}</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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.