On this page:
parameter-group?
define-parameter-group
parameterize/  group
parameterize*/  group
6.3.90.900

21 Parameter Groups

This library is unstable; compatibility will not be maintained. See Unstable: May Change Without Warning for more information.

 (require unstable/parameter-group)
  package: unstable-parameter-group-lib

Parameter groups are parameter-like views that represent multiple parameters.

Examples:
> (require unstable/parameter-group)
> (define param1 (make-parameter 1))
> (define param2 (make-parameter 2))
> (define-parameter-group params (param1 param2))
> (params)

(params-value 1 2)

> (parameterize/group ([params  (params-value 10 20)])
    (list (param1) (param2)))

'(10 20)

> (params)

(params-value 1 2)

> (params (params-value 100 200))
> (list (param1) (param2))

'(100 200)

Use parameter groups to conveniently set multiple parameters. For example, the plot library uses parameter groups to save and restore appearance-controlling parameters when it must draw plots within a thunk.

procedure

(parameter-group? v)  boolean?

  v : any/c
Returns #t when v is a parameter group.

syntax

(define-parameter-group name (param-or-group-expr ...) options)

 
options = 
  | #:struct struct-name
 
  param-or-group-expr : (or/c parameter? parameter-group?)
Defines a new parameter group.

If struct-name is not given, define-parameter-group defines a new struct <name>-value to hold the values of parameters.

If struct-name is given, it must have a constructor (struct-name param-or-group-expr ...) that accepts as many arguments as there are parameters in the group, and a struct-name match expander that accepts as many patterns as there are parameters.

Examples:
> (struct two-params (p1 p2) #:transparent)
> (define-parameter-group params* (param1 param2) #:struct two-params)
> (params*)

(two-params 100 200)

syntax

(parameterize/group ([param-or-group-expr  value-expr] ...)
  body-expr ...+)
 
  param-or-group-expr : (or/c parameter? parameter-group?)
Corresponds to parameterize, but can parameterize parameter groups as well as parameters.

syntax

(parameterize*/group ([param-or-group-expr  value-expr] ...)
  body-expr ...+)
 
  param-or-group-expr : (or/c parameter? parameter-group?)
Corresponds to parameterize*, but can parameterize parameter groups as well as parameters.