Eric Torreborre
2007-06-21 00:15:57 UTC
Hi,
I am new to Scala and I am just starting playing with it.
I find for-comprehensions very useful to generate combinatorial data in a
single statement, however I would like to know what the idiomatic way in
scala to use this generation either as a List or as a LazyList.
I understand that:
for (d <- days; w <- weeks) yield s + "." + w
returns a List[String]. But what if I find that there are too many values
and I prefer to consume them as in a LazyList. Is there a way to do that
without modifying my for-comprehension code?
Thanks,
Eric
I am new to Scala and I am just starting playing with it.
I find for-comprehensions very useful to generate combinatorial data in a
single statement, however I would like to know what the idiomatic way in
scala to use this generation either as a List or as a LazyList.
I understand that:
for (d <- days; w <- weeks) yield s + "." + w
returns a List[String]. But what if I find that there are too many values
and I prefer to consume them as in a LazyList. Is there a way to do that
without modifying my for-comprehension code?
Thanks,
Eric
--
View this message in context: http://www.nabble.com/For-comprehension-and-LazyList-tf3955830.html#a11224658
Sent from the Scala mailing list archive at Nabble.com.
View this message in context: http://www.nabble.com/For-comprehension-and-LazyList-tf3955830.html#a11224658
Sent from the Scala mailing list archive at Nabble.com.