Primitive Functions



next up previous
Next: Primitive Syntax Up: libscheme Architecture Previous: Object Representation

Primitive Functions

Primitive functions in Scheme are implemented as C functions that take two arguments, an argument count and a vector of Scheme_Objects. Each primitive is responsible for checking for the correct number of arguments-allowing maximum flexibility for procedures of variable arity-and for checking the types of its arguments. All arguments to a primitive function are evaluated before they are passed to the primitive, following Scheme semantics. If the application writer wants to create a primitive that doesn't evaluate its arguments, she must use a syntax primitive. C functions are turned into libscheme primitives with the scheme_make_prim() function that accepts the C function as an argument and returns a new Scheme object of type scheme_prim_type.



Brent Benson
Mon Sep 19 16:03:14 EDT 1994