Skip to content

Instantly share code, notes, and snippets.

View HerbM's full-sized avatar

Herb Martin HerbM

  • LearnQuick.Com
  • Austin, TX
View GitHub Profile
@HerbM
HerbM / map_fold.ps1
Created June 17, 2017 10:00 — forked from cdhunt/map_fold.ps1
Map and Fold implementations in Powershell
function map([scriptblock]$map, [Collections.IEnumerable]$x, $y) { $x.ForEach({& $map $_ $y}) }
# Two parameters
map { param($x, $y) $x + $y } @(1,2,3) 10
# Anonymous function as a value
$squareIt = { param($x) $x + $x }
map $squareIt @(1,2,3)
# One parameter