If you are writing a partially applied function expression in which you leave off all parameters, such as println _ or sum _, you can express it more concisely by leaving off the underscore if a [...], e.g. instead of someNumbers.foreach(println _)
you could just write someNumbers.foreach(println)
Answer
function is required at that point in the code (remember that when anything, not specifically a function is required, like in assignment val b = sum _, leaving off _ won't work).
Tags
#odersky-programming-in-scala-2ed #scala
Question
If you are writing a partially applied function expression in which you leave off all parameters, such as println _ or sum _, you can express it more concisely by leaving off the underscore if a [...], e.g. instead of someNumbers.foreach(println _)
you could just write someNumbers.foreach(println)
Answer
?
Tags
#odersky-programming-in-scala-2ed #scala
Question
If you are writing a partially applied function expression in which you leave off all parameters, such as println _ or sum _, you can express it more concisely by leaving off the underscore if a [...], e.g. instead of someNumbers.foreach(println _)
you could just write someNumbers.foreach(println)
Answer
function is required at that point in the code (remember that when anything, not specifically a function is required, like in assignment val b = sum _, leaving off _ won't work).
If you want to change selection, open document below and click on "Move attachment"
Open it If you are writing a partially applied function expression in which you leave off all parameters, such as println _ or sum _, you can express it more concisely by leaving off the underscore if a function is required at that point in the code, e.g. instead of
someNumbers.foreach(println _)
you could just write
someNumbers.foreach(println)
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.