scala - Exit for loop as soon as condition satisfied -


the following code hangs repl:

(   {     <- 1 1000000     j <- 2 1000000     if * == j   } yield -> j ).take(1) 

it seems expression eagerly evaluated. solutions?

i'd turn stream:

(     {         <- stream.range(1, 1000000)         j <- stream.range(2, 1000000)         if * == j     } yield -> j ).take(1) 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

Kivy: Swiping (Carousel & ScreenManager) -

jdbc - Not able to establish database connection in eclipse -