In the following: val isEven: Int => Boolean = _ % 2 == 0 Did I declare an anonymous function, or a function called isEven using function literal syntax? Or both?
-
Show this thread
-
This is an actual question - my reasoning has always been that since the function was named (isEven), it was by definition not anonymous. I assumed that anonymous functions were function literals passed directly to higher order functions, for example. But now I don't know :/
4 replies 0 retweets 3 likesShow this thread
Replying to @NicolasRinaudo
You can consider that anonymity depends on the scope. On the RHS of the `=`, the function is anonymous. But as soon as your scope binds an identifier to the function, it ceases to be anonymous.
5:45 PM - 20 Nov 2019
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.