RosettaCodeData/Task/First-class-functions/Dyalect/first-class-functions-3.dya...

8 lines
133 B
Plaintext

func Iterator.Filter(pred) {
for x in this when pred(x) {
yield x
}
}
[1,2,3,4,5].Iterate().Filter(x => x % 2 == 0)