global variable
Posted: Fri Jul 13, 2012 1:05 am
Hi,
Can we define global variable in lisp !? If we have it in lisp, how we can define it ?
Can we define global variable in lisp !? If we have it in lisp, how we can define it ?
Discuss and learn Lisp programming of all dialects. NOTICE: Site locked. No new users or posts.
http://www.lispforum.com/
Hi mparsa,mparsa wrote:Hi,
Can we define global variable in lisp !? If we have it in lisp, how we can define it ?
mparsa wrote:Hi,
Can we define global variable in lisp !? If we have it in lisp, how we can define it ?
Code: Select all
(defvar foo 3)
Code: Select all
(defvar foo 3 "This is foo, which should be 3")
Code: Select all
(unintern 'foo)
Code: Select all
(in-package :CL-USER)
(defvar foo 3)
(defpackage (:MY-PACK
(:use :CL))
(in-package :MY-PACK)
(eql cl-user:foo 3)
Code: Select all
(defpackage :protected-test
(:use :CL :CL-USER)
(:export :baz)
(in-package :protected-test)
(defvar baz 3)
(defvar foo 4)
(in-package :CL-USER)
(eql protected-test:baz 3)
(eql protected-test:foo 4)
(eql protected-test::foo 4)