Page 1 of 1

(context?) and (sym)

Posted: Sat Apr 15, 2006 3:20 pm
by Dmi

Code: Select all

> (sym "CON" MAIN nil)
CON
> (context? CON)
true
> (context? (sym "CON" MAIN nil))
nil
The conttext CON is already exists before this tests,

Is there a way to check the existence of a context given by a string?

Posted: Sat Apr 15, 2006 3:30 pm
by Lutz
Yes, just add 'eval' ;)

Code: Select all

> (sym "CON" MAIN nil)
nil
> (set 'CON:foo 123)
123
> (sym "CON" MAIN nil)
CON
> (context? (eval (sym "CON" MAIN nil)))
true
Lutz

Posted: Sat Apr 15, 2006 3:38 pm
by Dmi
The genius is simple :-)
Thanks!