An as-pattern has the form v@p
where v
is a regular identifier and p
is a pattern. This pattern matches if p
matches, and the variable v
will be bound in the body to the value matching p
.
For example, this expression evaluates to 3
:
An as-pattern has the form v@p
where v
is a regular identifier and p
is a pattern. This pattern matches if p
matches, and the variable v
will be bound in the body to the value matching p
.
For example, this expression evaluates to 3
: