Back2Basics: Do you know Scala Eta-Expansion and HOF Chemistry?

Knoldus Blogs

I am working on Scala from last 2 years, and pretty confident about Scala concept like HOF, Currying and more. But Recently again looking into the HOF (Higher Order Functions) in Scala. I am pretty confident, HOF is “Passed a function as an argument”, “Assign functions to variables” and “Return functions from function” and the conclusion is Functions are First Class Citizen.

For me, these below statements are equal:-

First is, anonymous function or lambda expression and second is a function with the name. But we can pass these two function to any function which accepts the function as an argument with this signature Int => Int.

While I am trying to execute these two statements in scala REPL, but this time I noticed, the output of these two statements are different, which insist me to investigate why this behavior?

The first line of code initializes some lambda expression…

View original post 287 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s