examples: add more C code to embed example
Including printing the result and funcalling lambda with arguments.
This commit is contained in:
parent
612eeb5ed1
commit
94e4e9bf04
2 changed files with 13 additions and 2 deletions
|
|
@ -1 +1,3 @@
|
||||||
(defun hello-lisp () (format t "hello-lisp!~%"))
|
(defun hello-lisp ()
|
||||||
|
(format t "hello-lisp!~%")
|
||||||
|
:foo)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,16 @@ int main (int argc, char **argv) {
|
||||||
extern void init_lib_HELLO_LISP(cl_object);
|
extern void init_lib_HELLO_LISP(cl_object);
|
||||||
ecl_init_module(NULL, init_lib_HELLO_LISP);
|
ecl_init_module(NULL, init_lib_HELLO_LISP);
|
||||||
|
|
||||||
cl_eval(c_string_to_object("(hello-lisp)"));
|
cl_object result = cl_eval(c_string_to_object("(hello-lisp)"));
|
||||||
|
ecl_print(result, ECL_T);
|
||||||
|
|
||||||
|
cl_object my_fun = cl_eval(c_string_to_object("(lambda (x) (1+ x))"));
|
||||||
|
ecl_print(my_fun, ECL_T);
|
||||||
|
|
||||||
|
result=cl_funcall(2, my_fun, ecl_make_fixnum(8));
|
||||||
|
ecl_print(result, ECL_T);
|
||||||
|
|
||||||
|
ecl_terpri(ECL_T);
|
||||||
|
|
||||||
cl_shutdown();
|
cl_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue