Fancy App: Scala-Style Magic Lambdas
This package provides a simple shorthand for defining anonymous functions. When
required, writing (+ _ 1) becomes equivalent to writing
(λ (v) (+ v 1)).
Equivalent to normal function application as in racket/base
is a _
. In that case, the expression
is transformed into an anonymous function expression with one argument for each
found among the given expr
s. Uses of _
converted to positional arguments from left to right.
Note that a use of _ that is nested within one of the given
exprs does not count. Additionally, using _ after a keyword
is not treated specially and does not trigger creation of a keyword argument.
arguments are not supported.
|> (+ 1 (+ _ 2))|
+: contract violation
|> (define (add/kw a #:to b) (+ a b))|
|> (define add2 (add/kw 2 #:to _))|
|> (add2 10)|
|> (add2 #:to 10)|
application: procedure does not accept keyword arguments