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 -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -