Question

Firstly I had an issue finding #:: method of Stream. Which got resolved from this.

Now I am looking for the below method in the Stream

 def iterate[A](start: A, len: Int)(f: A => A): Stream[A]

The Stream API has no mention of it.

Secondly in the Scala Doc, why can't they have all the inner classes defined in the same respective parent class itself. Why does a user has to go and click at c character on left panel to search for Stream.consWrapper when he could directly read it inside the documentation for Stream itself?

Am I missing something? I am a Scala newbie (3 months), but if a new user can't get used to it, most of it will not be able to.

Was it helpful?

Solution

iterate is not a method of the Stream class, but a method of the Stream object. It is described here.

From the scaladoc page for the Stream class that you linked, you can go directly to the scaladoc page for the Stream object by clicking on the "C" (for "class") icon at the top, and back by clicking on the "O" icon.

As for finding operators, you can click on "#" at the top of the left search panel, which brings you to this page which lists all operators of the standard library. There you can find mention of the #:: operator and just ckick on it.

As for ConsWrapper, it is a member of the Stream object, not a member of the Stream class. And sure enough, you will find it mentioned on the scaladoc page for the Stream object, in the "Type members" section.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top