4 ms·
In Common Lisp you can have namespaces, where you can have your own SETQ: CL-USER 53 > (defpackage mylisp (:use "COMMON-LISP") ; everythi
by lispm 4y ago
In Common Lisp you can have namespaces, where you can have your own SETQ:
CL-USER 53 > (defpackage mylisp
(:use "COMMON-LISP") ; everything from Common Lisp
(:shadow CL:SETQ)) ; but not SETQ
#<The MYLISP package, 1/16 internal, 0/16 external>
CL-USER 54 > (in-package "MYLISP")
#<The MYLISP package, 1/16 internal, 0/16 external>
MYLISP 55 > (defun setq (a b c) (print (list a b c)))
SETQ
MYLISP 56 > (setq (+ 1 2) 4 5)
(3 4 5)
(3 4 5)
MYLISP 57 > (cl:setq a 12)
12
Most implementations also have a way to protect core symbols against redefinition and a way to do it anyway (possibly shooting yourself into the foot).
- mtlmtlmtlmtl 4y agoRight, I forgot about packages. Been far too long since I had an excuse to write Common Lisp :(