1 // Store a function definition
7 // For this definition, p1 points to the following structure.
11 // ___v__ ______ ______
12 // |CONS |->|CONS |--------------------->|CONS |
13 // |______| |______| |______|
15 // ___v__ ___v__ ______ ______ ___v__ ______ ______
16 // |SETQ | |CONS |->|CONS |->|CONS | |CONS |->|CONS |->|CONS |
17 // |______| |______| |______| |______| |______| |______| |______|
19 // ___v__ ___v__ ___v__ ___v__ ___v__ ___v__
20 // |SYM f | |SYM x | |SYM y | |POWER | |SYM x | |SYM y |
21 // |______| |______| |______| |______| |______| |______|
25 // caadr(p1) points to f
26 // cdadr(p1) points to the list (x y)
27 // caddr(p1) points to (power x y)
32 #define F p3 // F points to the function name
33 #define A p4 // A points to the argument list
34 #define B p5 // B points to the function body
37 define_user_function(void)
44 stop("function name?");
46 // evaluate function body (maybe)
48 if (car(B
) == symbol(EVAL
)) {
54 set_binding_and_arglist(F
, B
, A
);
56 // return value is nil