Multiple and Keyword Return Values
values+
call-with-values+
define-values+
let-values+
let*-values+
6.12

Multiple and Keyword Return Values

Jay McCarthy <[email protected]>

 (require values+) package: values-plus

procedure

(values+ v ... #:<kw> kw-arg ...)  any

  v : any/c
  kw-arg : any/c
Like values, but with support for keyword arguments as received by call-with-values+, define-values+, let-values+, or let*-values+.

If no keyword arguments are provided to values+, then it returns results equivalent to using values.

If keyword arguments provided to values+, then the values are returned via values, and using a particular encoding that is not meant to be inspected directly (except by the implementation of call-with-values+, etc.). Currently, the encoding is multiple values as follows: a generated symbol that effectively tags the results as keyword results, a list of keywords, a list of values in parallel to the keyword list, and the remaining non-keyword values.

procedure

(call-with-values+ generator receiver)  any

  generator : (-> any)
  receiver : procedure?
Like call-with-values, but keyword arguments returned via values+ can be received as keyword arguments of receiver. If receiver has no required keyword arguments, then it can also receive a single return value from generator or multiple non-keyword values.

syntax

(define-values+ kw-formals rhs-expr)

syntax

(let-values+ ([kw-formals rhs-expr]) body ...+)

syntax

(let*-values+ ([kw-formals rhs-expr]) body ...+)

Like define, let-values, and let*-values, but supporting kw-formals as in lambda to receive optional and keyword return values from rhs-expr.