Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete variable/forms in Lisp?

In Python we have the del statement for deleting variables.

E.g:

a = 1
del a

What the equivalent of this in Lisp?

(setq foo 1)
;; (del foo) ?
like image 566
Bleeding Fingers Avatar asked Jan 20 '14 10:01

Bleeding Fingers


1 Answers

In Common Lisp.

For symbols as variables:

CL-USER 7 > (setf foo 42)
42

CL-USER 8 > foo
42

CL-USER 9 > (makunbound 'foo)
FOO

CL-USER 10 > foo

Error: The variable FOO is unbound.

See:

  • MAKUNBOUND (defined)
  • SLOT-MAKUNBOUND (defined)
  • FMAKUNBOUND (defined)
like image 187
Rainer Joswig Avatar answered Oct 02 '22 21:10

Rainer Joswig