Test on iterator filter and map

This commit is contained in:
2024-07-13 15:30:04 +02:00
parent d7a7b3218c
commit cde2efacf1
2 changed files with 17 additions and 2 deletions
+15
View File
@@ -0,0 +1,15 @@
ds={
"init":func(end){@end=end; @current=0 but true},
"current":func(){current},
"next":func(){
((next=current+1) <= end) ? [true] {@current=next but current} :: {nil}
}
, "filter":func(item,index) { item > 0 }
, "map": func(item,index) { item * 2 }
}
/* Example
;
it=$(ds,3);
add(it)
*/