How to read ( understand) scala standard library function?

Hi All, Sorry if its been asked before. I tried to look for the answer in many places, but could not find it.
Is there any resource ( blog or video etc ) on how to understand the syntax of scala standard library function definition? for example

@ val a = Set(1,2,3)
a: Set[Int] = Set(1, 2, 3)

I want to know what this function ( for example reduceLeft) does by pressing tabs and I got below

@ a.reduceLeft
def reduceLeft[B >: A](op: (B, A) => B): B
Now I want to understand such syntax without looking for help so that I can start practicing on it.

There must be some resources on how to understand such syntax? is there any easier way?

Tour of Scala might help learning syntax and language features.

If you want to visually understand Scala standard library functions, such as Seq#reduceLeft, visual Scala reference might help is a good resource.

5 Likes

Thank you so much

If you have a Java background, you may find the following helpful (download for best quality):


The aggregate function - from sequential and parallel folds to parallel aggregation - Java and Scala

@rabinjais7 Please get a high quality source and spend some time with it to properly understand the language. This will save you a ton of time in the long term.

Avoid short tutorials / videos / Stackoverflow / Google searches. Also please do not try to learn it from the documentation. Documentation should be used as reference only, not as a proper learning resource.

I recommend:

1 Like

What part of that syntax you don’t understand?
Also, have you checked the Scaladoc?

1 Like

there are some Scala book recommendations at Books | Scala Documentation

(Introduction | Tour of Scala | Scala Documentation is definitely useful for quickly looking up a thing you haven’t seen before, to get a basic idea of what something is, but it’s not a comprehensive language intro)

2 Likes