Apply a callback to an array: Difference between revisions

m
No edit summary
Line 2,381:
<lang powershell>function map ([array] $a, [scriptblock] $s) {
$a | ForEach-Object $s
}
}</lang>
map (1..5) { $_ * $_ }</lang>
 
=={{header|Prolog}}==
678

edits