blob: 4c86e27d3ff091b406e80a335071728df6b44b8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
<p>
Gleam has a shorthand syntax for creating anonymous functions that take one
argument and immediately call another function with that argument: the
function capture syntax.
</p>
<p>
The anonymous function <code>fn(a) { some_function(..., a, ...) }</code> can
be written as <code>some_function(..., _, ...)</code>, with any number of
other arguments passed directly to the inner function. The underscore
<code>_</code> is a placeholder for the argument, equivalent to
<code>a</code> in <code>fn(a) { some_function(..., a, ...) }</code>.
</p>
|