Previous: Instances, Up: Lisp objects
A bytecodes object is a lisp object with a piece of code that can be
interpreted. The objects of type t_bytecode
are implicitly constructed
by a call to eval
, but can also be explicitly constructed with the
make_lambda
function.
cl_safe_eval
evaluates form in the lexical environment env, which can be nil. Before evaluating it, the expression form must be bytecompiled.cl_eval
is the equivalent ofcl_safe_eval
but without environment and with err_value set to nil. It exists only for compatibility with previous versions.cl_object form = c_string_to_object("(print 1)"); cl_safe_eval(form,Cnil); cl_safe_eval(form, Cnil);
Builds an interpreted lisp function with name given by the symbol name and body given by def. For instance, we would achieve the equivalent of
(funcall #'(lambda (x y) (block foo (+ x y))) 1 2)with the following code
cl_object def = c_string_to_object("((x y) (+ x y))"); cl_object name = _intern("foo") cl_object fun = si_make_lambda(name, def); return funcall(fun, MAKE_FIXNUM(1), MAKE_FIXNUM(2));Notice that
si_safe_lambda
performs a bytecodes compilation of the definition and thus it may signal some errors. Such errors are not handled by the routine itself you might consider usingcl_safe_eval
orcl_eval
instead:cl_object def = c_string_to_object("#'(lambda-block foo (x y) (+ x y))"); cl_object fun = cl_eval(def); return funcall(fun, MAKE_FIXNUM(1), MAKE_FIXNUM(2));