Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 571 Bytes

variables.md

File metadata and controls

39 lines (30 loc) · 571 Bytes

Global variables

(defparameter *a* "intitial")
;; => *A*

(princ *a*)
;; => intitial
;;
;;    "intitial"
  • the surrounding asterisks (or 'earmuffs') are a convention to indicate that the variable is DYNAMIC or SPECIAL. More later.
(setf *a* "updated")
;; => "updated"

(princ *a*)
;; => updated
;;
;;    "updated"
  • A variable can be updated by using setf.
(setf *a* 42)
;; => 42

(princ *a*)
;; => 42
;;
;;    42
  • Common lisp is dynamically typed so we are free to change variables to different types