Globals is not a list


#1

Hello,

(listp globals)
nil

so unable to use for example (car globals)
is there a way to access each elements of globals?
Thank you


#2

No, globals is not a list, but it’s a function that returns a list. So, for example, you can do;

> (defun sq (x) (* x x))
sq

> (defvar pi 3.14159)
pi

> (globals)
(pi sq)

> (eval (car (globals)))
3.14159

#3

Thank you for your answer. I finaly understand that even globals is not a list (globals) is a list!
With the help of your example

(car (globals))

is working.

Thank you.