On this page:
partial
app
7.1

6 Partial application with keywords

 (require kw-utils/partial) package: kw-utils

procedure

(partial f arg ... #:<kw> kw-arg ...)  procedure?

  f : procedure?
  arg : any/c
  kw-arg : any/c
(partial #:<kw> kw-arg ...)  procedure?
  kw-arg : any/c
Similar to curry, but better thought of as a generalization of partial from rackjure. Unlike curry, (but like the rackjure version), it does not care about function arity, and so has much simpler behavior, so that ((partial f in-arg ...) out-arg ...) is equivalent to (f in-arg ... out-arg ...) no matter what arity f has. It also generalizes this idea to include keyword arguments.

Examples:
> (require kw-utils/partial)
> ((partial + 1 2))

3

> ((partial + 1) 2)

3

> ((partial +) 1 2)

3

> ((partial) + 1 2)

3

> (define (KE #:m m #:v v)
    (* 1/2 m v v))
> ((partial KE) #:m 2 #:v 1)

1

> ((partial KE #:m 2) #:v 1)

1

> ((partial KE #:m 2 #:v 1))

1

> ((partial) KE #:m 2 #:v 1)

1

> ((partial #:m 2) KE #:v 1)

1

procedure

(app f arg ... #:<kw> kw-arg ...)  any

  f : procedure?
  arg : any/c
  kw-arg : any/c
A procedure for normal function application. (partial #:<kw> kw-arg ... ...) is equivalent to (partial app #:<kw> kw-arg ... ...).

Examples:
> (require kw-utils/partial)
> (+ 1 2)

3

> (app + 1 2)

3

> (define (KE #:m m #:v v)
    (* 1/2 m v v))
> (KE #:m 2 #:v 1)

1

> (app KE #:m 2 #:v 1)

1