I've written this (which works):
function ForAll {
BEGIN {
$allTrue = $true
}
PROCESS {
if ($_ -lt 1) { $allTrue = $false }
}
END {
$allTrue
}
}
$aList = (0..4)
$bList = (1..4)
$aList | ForAll # returns false
$bList | ForAll # returns true
But what I want to do is replace the ($_ -lt 1) with a function called something like $predicate that I pass into the ForAll function. I can't seem to get this to work. Any ideas?