Google

PLT MzLib: Libraries Manual


compat.ss: Compatibility

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)      PROCEDURE

Same as (not (pair? v)).

(define-structure (name-identifier field-identifier ···))      SYNTAX

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) ···))      SYNTAX

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-identifiers 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-identifiers are bound in init-exprs, but not the init-field-identifiers.

Example:

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

(getprop sym property default)      PROCEDURE

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])      PROCEDURE

Emulates Chez Scheme's new-cafe.

(putprop sym property value)      PROCEDURE

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

(sort less-than?-proc list)      PROCEDURE

This is the same as mergesort (see section 18) with the arguments reversed.