PREV UP NEXT SCM

6.1.4: Subr Cells

A Subr is a header whose CDR points to a C code procedure. Scheme primitive procedures are subrs. Except for the arithmetic tc7_cxrs, the C code procedures will be passed arguments (and return results) of type SCM.

Subr: tc7_asubr
associative C function of 2 arguments. Examples are +, -, *, /, max, and min.
Subr: tc7_subr_0
C function of no arguments.
Subr: tc7_subr_1
C function of one argument.
Subr: tc7_cxr
These subrs are handled specially. If inexact numbers are enabled, the CDR should be a function which takes and returns type double. Conversions are handled in the interpreter.

floor, ceiling, truncate, round, $sqrt, $abs, $exp, $log, $sin, $cos, $tan, $asin, $acos, $atan, $sinh, $cosh, $tanh, $asinh, $acosh, $atanh, and exact->inexact are defined this way.

If the CDR is 0 (NULL), the name string of the procedure is used to control traversal of its list structure argument.

car, cdr, caar, cadr, cdar, cddr, caaar, caadr, cadar, caddr, cdaar, cdadr, cddar, cdddr, caaaar, caaadr, caadar, caaddr, cadaar, cadadr, caddar, cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cddadr, cdddar, and cddddr are defined this way.

Subr: tc7_subr_3
C function of 3 arguments.
Subr: tc7_subr_2
C function of 2 arguments.
Subr: tc7_rpsubr
transitive relational predicate C function of 2 arguments. The C function should return either BOOL_T or BOOL_F.
Subr: tc7_subr_1o
C function of one optional argument. If the optional argument is not present, UNDEFINED is passed in its place.
Subr: tc7_subr_2o
C function of 1 required and 1 optional argument. If the optional argument is not present, UNDEFINED is passed in its place.
Subr: tc7_lsubr_2
C function of 2 arguments and a list of (rest of) SCM arguments.
Subr: tc7_lsubr
C function of list of SCM arguments.