8.18.0.15
1 Syntax
1.1 Importing non-function values lazily
| (require toolbox/lazy-require) | package: toolbox-lib |
In addition to the bindings documented in this section, toolbox/lazy-require also reprovides lazy-require from racket/lazy-require.
syntax
(lazy-require/value [module-path {import ...}] ...)
import = id | [orig-id bind-id]
Like lazy-require, but the imported bindings need not be functions. Instead, each imported binding triggers module loading the first time a use of the binding is evaluated. Note that this is more eager than lazy-require, which only triggers module loading when the imported binding is applied.
Examples:
1.2 Lifting expressions
| (require toolbox/lift) | package: toolbox-lib |
When expanded as an expression, #%lift lifts expr to the module top level using syntax-local-lift-expression and expands to the fresh identifier it was bound to.
1.3 Automatic printing in blocks
| (require toolbox/printing-block) | package: toolbox-lib |
syntax
(printing-block defn-or-expr ...+)
Like (let () defn-or-expr ...), but values returned by each expression in the block are printed in the same way as at the top level of a module.
Example:
> (printing-block (+ 1 2 3) (string-upcase "hello") (not #f))
6
"HELLO"
#t
#t
1.4 Context-sensitive who
| (require toolbox/who) | package: toolbox-lib |
syntax
(define/who id expr)
(define/who (head args) body ...+)
Like define, except who evaluates to 'id within the lexical extent of the expr, args, or body forms.
Examples:
> (define/who (vector-first v) (when (zero? (vector-length v)) (raise-arguments-error who "empty vector")) (vector-ref v 0)) > (vector-first (vector)) vector-first: empty vector
syntax
When used as an expression within define/who, evaluates to a symbol corresponding to the name of the definition.