scala folks: why is scala's Iterator defined with hasNext and next? Why not
trait Iterator[T] { def next: Option[T] }
I blame @extempore2
-
-
Replying to @posco
@posco@extempore2 Well, in order to verify if a value is there, you must mutate the iterator. Eg. implement isEmpty without hasNext.2 replies 0 retweets 1 like -
Replying to @tixxit
You could use {def next: LazyOption[T]}. But the real "purely functional Iterator" is Stream's interface.
@tixxit@posco@extempore21 reply 0 retweets 0 likes -
Replying to @Blaisorblade
@Blaisorblade@posco@extempore2 You've still mutated the iter by calling next right? Otherwise you have pushed hasNext/next to lazy option.1 reply 0 retweets 0 likes -
Replying to @tixxit
@tixxit@posco@extempore2 Retract. My (bad) plan was that LazySome's by-name content could advance the iterator.1 reply 0 retweets 0 likes -
Replying to @Blaisorblade
@tixxit@posco@extempore2 My main point was "reinventing Stream is *HARD*", I've unwillingly violated my own advice and added evidence o_O1 reply 0 retweets 0 likes
@Blaisorblade @posco @extempore2 he he, agreed - want functional, use a stream, with or without memo.
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.