[previous] [up] [next]     [contents] [index]
Next: Match Up: MzLib Libraries Previous: Inflating Compressed Data

Macros

Files: macro.ss, macroc.ss



(class-asi superclass clauses tex2html_wrap_inline12550 ) SYNTAX

Like class, but the initialization arguments are automatically passed on to the superclass initialization procedure.



(class*-asi superclass interfaces clauses tex2html_wrap_inline12550 ) SYNTAX

Like class*, but the initialization arguments are automatically passed on to the superclass initialization procedure.



(catch-errors err-display err-result body-expr tex2html_wrap_inline12552 ) SYNTAX

In the absence of run-time errors, the result of a catch-errors expression is the result of the last body-expr. If an error is encountered during the evaluation of the body-exprs, err-display is invoked as the error display handler and the result of the catch-errors expression is the result of applying the thunk err-result. If err-display is #f, then the current error display handler is used instead.



(evcase key-expr (value-expr body-expr tex2html_wrap_inline12550 ) tex2html_wrap_inline12552 ) SYNTAX

The evcase form is similar to case, except that expressions are provided in each clause instead of a sequence of data. After key-expr is evaluated, each value-expr is evaluated until a value is found that is eqv? to the key value; when a matching value is found, the corresponding body-exprs are evaluated and the value(s) for the last is the result of the entire evcase expression.

A value-expr can be the special identifier else. This identifier is recognized as in case (see section 3.2).



(let+ clause body-expr tex2html_wrap_inline12552 ) SYNTAX

A new binding construct that specifies scoping on a per-binding basis instead of a per-expression basis. It helps eliminate rightward-drift in programs. It looks a lot like let, except each clause has an additional keyword tag before the binding variables.

Each clause has one of the following forms:

The clauses bind left-to-right. Each variable above can either be an identifier or (values variable tex2html_wrap_inline12550 ). In the latter case, multiple values returned by the corresponding expression are bound to the mulitple variables.

Examples:

  (let+ ([val (values x y) (values 1 2)]) 
     (list x y)) ; => (1 2) 
  (let ([x 1])
     (let+ ([val x 3] 
            [val y x])
        y)) ; => 3 



(let-enumerate name-lists body-expr tex2html_wrap_inline12552 ) SYNTAX

This is a let-form, but instead of name-value pairs, sequnces of variables are specified. For each variable sequence, the first variable is bound to the constant 1, the second variable is bound to 2, etc.

For example:

  (let-enumerate ([FILE-OPEN
                   FILE-CLOSE
                   FILE-QUIT]
                  [EDIT-COPY
                   EDIT-CUT
                   EDIT-PASTE])
      body) 

Within body, FILE-OPEN is 1, FILE-CLOSE is 2, FILE-QUIT is 3, EDIT-COPY is 1, etc.



(local (definition tex2html_wrap_inline12550 ) body-expr tex2html_wrap_inline12552 ) SYNTAX

This is a binding form similar to letrec, except that each definition is a define-values, define, or define-struct expression (before macro-expansion). The body-exprs are evaluated in the lexical scope of these definitions.



(opt-lambda formals body-expr tex2html_wrap_inline12552 ) SYNTAX

The opt-lambda form is like lambda, except that default values are assigned to parameters (C++-style). Default values are defined in the formals list by replacing each variable by [variable default-value-expression]. If an variable has a default value expression, then all (non-aggregate) variables after it must have default value expressions. A final aggregate variable can be used as in lambda, but it cannot be given a default value. Each default value expression is evaluated only if it is needed. The environment of each default value expression includes the preceding parameters.

For example:

  (define f
     (opt-lambda (a [b (add1 a)] . c)
        ...)) 

Here, f is a procedure which takes at least one argument. If a second argument is specified, it is the value of b, otherwise b is (add1 a). If more than two arguments are specified, then the extra arguments are placed in a new list that is the value of c.



(recur name bindings body-expr tex2html_wrap_inline12552 ) SYNTAX

This is equivalent to a named let: (let name bindings body-expr tex2html_wrap_inline12552 ).



(send* obj msg tex2html_wrap_inline12550 ) SYNTAX

Calls multiple methods of obj (in the specified order). Each msg should have the form:

  (name params ...) 
where name is the method name. For example:
  (send* edit (begin-edit-sequence)
              (insert "Hello")
              (insert #\newline)
              (end-edit-sequence)) 
is the same as
  (let ([e edit])
    (send e begin-edit-sequence)
    (send e insert "Hello")
    (send e insert #\newline)
    (send e end-edit-sequence)) 



(signature->symbols name) SYNTAX

Expands to the ``exploded'' version (see section 7.4.3) of the signature currently bound to name (where name is an unevaluated identifier). The expansion-time value of name (see section 13.3) must have the shape of an exploded signature.


[previous] [up] [next]     [contents] [index]
Next: Match Up: MzLib Libraries Previous: Inflating Compressed Data

PLT