Underscores
provides a macro @_
for passing closures to functions by
interpreting _
placeholders as anonymous function arguments. For example
@_ map(_+1, xs)
means map(x->x+1, xs)
.
Underscores
is useful for writing anonymous functions succinctly and without
naming the arguments. This is particular useful for data processing pipelines
such as
@_ people |> filter(_.age > 40, __) |> map(_.name, __)
Read the documentation for
more information, or see the online help for the @_
macro.