(context?) and (sym)

For the Compleat Fan
Locked
Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

(context?) and (sym)

Post 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?
WBR, Dmi

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

The genius is simple :-)
Thanks!
WBR, Dmi

Locked