IList<A>.generate constructor
Implementation
factory IList.generate(int n, A f(int i)) {
final IList<A> aNil = nil();
if (n <= 0) {
return aNil;
}
Cons<A> result = new Cons(f(0), aNil);
final IList<A> resultHead = result;
for(int i = 1;i < n;i++) {
final next = new Cons(f(i), aNil);
result._unsafeSetTail(next);
result = next;
}
return resultHead;
}