You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears we lack a combinator to create IndexedSeq[A] backed by a size and a user-supplied function Int => A, eg
def fromFunction[A](n: Int, f: Int => A) = new IndexedSeq[A] {
def length = n
def apply(i: Int): A = f(i)
}
The difference to the existing tabulate is that tabulate will eagerly invoke the function at creation time, whereas the above impl will invoke f when needed.
The text was updated successfully, but these errors were encountered:
It appears we lack a combinator to create
IndexedSeq[A]
backed by a size and a user-supplied functionInt => A
, egThe difference to the existing
tabulate
is that tabulate will eagerly invoke the function at creation time, whereas the above impl will invokef
when needed.The text was updated successfully, but these errors were encountered: