Sequence Comprehensions

Incredible: it turns out that the for expression syntax for list comprehensions I described in my last post is almost identical to the syntax of sequence comprehensions in Scala. Compare this saturn code:

for (x: ints, x % 2 == 0) -> x

with this code in Scala:

for (val x <- ints; x % 2 == 0) yield x

Looks pretty familiar right? I do like the saturn syntax better, though.

Why do I keep having other people’s ideas?

Leave a Reply

Your email address will not be published.


*