8.18
top
← prev up next →

Parameter UtilitiesπŸ”— i

by Dave Herman and Sam Tobin-Hochstadt.

This library provides several utilities for parameters.

1Getting StartedπŸ”— i

Everything in this library is exported by a single module:

2Pseudo-ParametersπŸ”— i

A pseudo-parameter is like a Racket parameter, but comprises both an accessor and a mutator function. This can be used, for example, to create compound parameters that simultaneously update multiple parameters.

procedure

( make-pseudo-parameter gettersetter)(pseudo-parameter/c a)

getter:(->a)
setter:(a->any)
Constructs a new pseudo-parameter with getter and setter functions.

procedure

( pseudo-parameter? x)boolean?

x:any
Determines whether a given value is a pseudo-parameter.

procedure

( pseudo-parameter/c c)contract?

c:contract?
A contract constructor for pseudo-parameters with an underlying value of contract c.

3Parameter SetsπŸ”— i

A parameter set is a collection of Racket parameters that can be read or written to all at once with a prefab structure. Because the structure is prefab, a parameter set can also easily be marshalled and demarshalled (assuming its values are all write able, of course).

syntax

( define-parameter-set struct-idpseudo-id
(param-iddefault-exprmaybe-guard)...)
maybe-guard =
| guard-expr
Defines a parameter set. The struct-id is defined as a prefab structure type with one field for each parameter in the set, in declaration order. The pseudo-id is defined as a pseudo-parameter that reads or writes the values of all the parameters in the set simultaneously. Each param-id is defined as a parameter with default value computed by default-expr and optional guard computed by maybe-guard.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /