Alex Rivera | Logout

Is it possible to use 'yield' to generate 'Iterator' instead of a list in Scala?

Asked 2010-12-24T09:34:20.183
29

Is it possible to use yield as an iterator without evaluation of every value?

It is a common task when it is easy to implement complex list generation, and then you need to convert it into Iterator, because you don't need some results...

Edit
Report

1 Answer

3

Use views if you want lazy evaluation, see Views.

The Scala 2.8 Collections API is a fantastic read if you're going to use the Scala collections a lot.

answered 2010-12-24T09:46:17.357

Your Answer