#
Chapter 10
`compat.ss`: Compatibility

To load: `(require (lib "compat.ss"))`

This library defines a number of procedures and syntactic forms that are commonly provided by other Scheme implementations. Most of the procedures are aliases for built-in MzScheme procedures, as shown in the table below. The remaining procedures and forms are described below.

`
Compatible | MzScheme
=? | =
<? | <
>? | >
<=? | <=
>=? | >=
1+ | add1
1- | sub1
gentemp | gensym
flush-output-port | flush-output
real-time | current-milliseconds
`

`(atom?``` `v``)` P R O C E D U R E

Same as `(`not` (pair? v))`.

`(`define-structure` `(name-identifier field-identifier `···`)`)` S Y N T A X

Like `define-struct`, except that the `name-identifier` is moved inside the parenthesis for fields. A second form of `define-structure`, below, supports initial-value expressions for fields.

`(`define-structure` `(name-identifier field-identifier `···`) ((init-field-identifier init-expr) `···`)`)` S Y N T A X

Like `define-struct`, except that the `name-identifier` is moved inside the parenthesis for fields, and additional fields can be specified with initial-value expressions.

The `init-field-identifier`s do not have corresponding arguments for the `make-`name-identifier`` constructor. Instead, the `init-field-identifier`'s `init-expr` is evaluated to obtain the field's value when the constructor is called. The `field-identifier`s are bound in `init-expr`s, but not the `init-field-identifier`s.

Example:

    (define-structure (add left right) ([sum (+ left right)]))
    (add-sum (make-add 3 6)) ; => 9

`(getprop``` `sym property default``)` P R O C E D U R E

Gets a property value associated with the symbol `sym`. The `property` argument is also a symbol that names the property to be found. If the property is not found, `default` is returned. If the `default` argument is omitted, `#f` is used as the default.

`(new-cafe``` [`eval-handler`]`)` P R O C E D U R E

Emulates Chez Scheme's `new-cafe`.

`(putprop``` `sym property value``)` P R O C E D U R E

Installs a value for `property` of the symbol `sym`. See `getprop` above.