[Ecls-list] [newbie] ECL and C++

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Mon Oct 1 17:27:13 UTC 2007


2007/10/1, ponch <ponch at autistici.org>:
> The statement with (setq b "boo")(b) correctly return the value boo,
> but in the first statement when i do this in two passes (setq a "foo")
> and then (a) it returns a value NIL as if the two lisp fragments would
> get executed in two different environment.

I am not entirely sure, but in lisp, if you do (setq b "boo") then (b)
does not return anything because there exists no function called "b".
The proper statement would be

  cl_object ret1 = cl_safe_eval(c_string_to_object(" a "),Cnil, Cnil);

instead of

  cl_object ret1 = cl_safe_eval(c_string_to_object("( a )"),Cnil, Cnil);

But of course, there are simpler ways, such as finding out the symbol
with the name "a" and aftewards susing ecl_symbol_value() to get its
value.

Other details: before assigning a value to a variable one uses one of
defparameter or defvar, because otherwise assignments are not well
defined and may or may not work, depending on the implementation.

Juanjo

-- 
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list