diff --git a/src/fusion/iterutils.nim b/src/fusion/iterutils.nim new file mode 100644 index 0000000..498a8b2 --- /dev/null +++ b/src/fusion/iterutils.nim @@ -0,0 +1,11 @@ +import sugar + +iterator findAll*[T](s : openArray[T], val : T) : int = + for i, x in s: + if x == val: + yield i + +iterator findAll*[T](s : openArray[T], pred : (T) -> bool) : int = + for i, x in s: + if pred x: + yield i \ No newline at end of file