scala Stream::filterNot not lazy -
a simple example following:
val set = set(0, 1, 2) stream.from(0).filternot(set).head
it seems loop forever; following code works:
stream.from(0).filter(!set(_)).head
i using
scala code runner version 2.11.4 -- copyright 2002-2013, lamp/epfl
is bug? or reason this?
according ticket: https://issues.scala-lang.org/browse/si-8627 implementation of filternot applies streams not lazy, manifest in seeing.
so, appears bug , according ticket, no way has been found fix without either significant performance penalties other collections or else breaking binary compatibility, hence seems targeted @ major release (2.12)
Comments
Post a Comment