_From @ochafik on September 1, 2011 18:34_ In Scala, if you run the test object P005 extends App{ val t = System.currentTimeMillis val r = (1 to 20) def isDivis(x:Int) = r forall {x % _ == 0} def find(n:Int):Int = if (isDivis(n)) n else find (n+2) println (find (2)) println((System.currentTimeMillis - t)/1000.0) } the forall is not optimized to a while loop, and runs in the same time as without ScalaCL. If you replace the "r" with its value (1 to 20), i.e. def isDivis(x:Int) = (1 to 20) forall {x % _ == 0} it is optimized and runs over 4 times faster. I think we should be able to get the same performance in both cases, since r is immutable, we know it will still be (1 to 20). Google Code Info: Issue #: 76 Author: bungle...@googlemail.com Created On: 2011-07-05T22:34:16.000Z Closed On: _Copied from original issue: ochafik/nativelibs4java#78_