Re:Underscore is a keyword in Java 9, use this script to che...
by alblue on Saturday January 14, 2017 @11:43AM
(#13399188)
The use of _ as a discardable placeholder has been present in many languages in the past, such as Haskell and Prolog. These aren't necessarily Scala-isms that Java is adopting; they have a much richer history.
[ Parent
| on HN ]
Re:Underscore is a keyword in Java 9, use this script to che...
by nilved on Saturday January 14, 2017 @11:50AM
(#13399231)
The way Scala uses them is very different from Haskell or Prolog. They are used to create lambdas, not discardable placeholders. E.g. `List(1, 2, 3) map (_ + 1)`.
Re:Underscore is a keyword in Java 9, use this script to che...
by pharrington on Saturday January 14, 2017 @02:48PM
(#13400198)
_ has a lot uses in Scala, one of them being to create lambdas, another as placeholders when pattern matching. for example val List(a, b, _, d) = List(1, 2, 3, 4)