pushed for loop into comprehension

optimalisation as per requested in thread (https://github.com/cwi-swat/rascal/pull/586)