scala folks: why is scala's Iterator defined with hasNext and next? Why not
trait Iterator[T] { def next: Option[T] }
I blame @extempore2
-
-
You could use {def next: LazyOption[T]}. But the real "purely functional Iterator" is Stream's interface.
@tixxit@posco@extempore2 -
@Blaisorblade@posco@extempore2 You've still mutated the iter by calling next right? Otherwise you have pushed hasNext/next to lazy option. - 3 more replies
New conversation -
-
-
@tixxit@extempore2 This is the best answer I've heard, and it springs from Iterator being mutable.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.