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

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -