Skip to content

Commit

Permalink
chore: regenerate documentation (#4696)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif authored Sep 13, 2024
1 parent 22b228b commit ddf5299
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion doc/md/base/Iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func filter<A>(xs : Iter<A>, f : A -> Bool) : Iter<A>
Takes a function and an iterator and returns a new iterator that produces
elements from the original iterator if and only if the predicate is true.
```motoko
import Iter "o:base/Iter";
import Iter "mo:base/Iter";
let iter = Iter.range(1, 3);
let mappedIter = Iter.filter(iter, func (x : Nat) : Bool { x % 2 == 1 });
assert(?1 == mappedIter.next());
Expand All @@ -131,6 +131,25 @@ assert(?10 == iter.next());
// ...
```

## Function `concat`
``` motoko no-repl
func concat<A>(a : Iter<A>, b : Iter<A>) : Iter<A>
```

Takes two iterators and returns a new iterator that produces
elements from the original iterators sequentally.
```motoko
import Iter "mo:base/Iter";
let iter1 = Iter.range(1, 2);
let iter2 = Iter.range(5, 6);
let concatenatedIter = Iter.concat(iter1, iter2);
assert(?1 == concatenatedIter.next());
assert(?2 == concatenatedIter.next());
assert(?5 == concatenatedIter.next());
assert(?6 == concatenatedIter.next());
assert(null == concatenatedIter.next());
```

## Function `fromArray`
``` motoko no-repl
func fromArray<A>(xs : [A]) : Iter<A>
Expand Down

0 comments on commit ddf5299

Please sign in to comment.