별의 공부 블로그 🧑🏻‍💻
728x90
728x170
;; Destructive Operations

;; CG-USER(28): (setf x nil)
;; NIL
;; CG-USER(29): (nconc x y)
;; (D E F)
;; CG-USER(30): x
;; NIL
;; CG-USER(31): y
;; (D E F)
;; CG-USER(32): (setf X (nconc X Y))
;; (D E F)
;; CG-USER(33): y
;; (D E F)
;; CG-USER(34): x
;; (D E F)

;; CG-USER(14): (setf x '(a b c))
;; (A B C)
;; CG-USER(15): (setf y '(d e f))
;; (D E F)
;; CG-USER(16): (setf z (append x y))
;; (A B C D E F)
;; CG-USER(17): z
;; (A B C D E F)
;; CG-USER(18): (nconc x y)
;; (A B C D E F)
;; CG-USER(19): x
;; (A B C D E F)
;; CG-USER(20): y
;; (D E F)

;; CG-USER(41): (setf Tree '(I say (e l (e l) o)))
;; (I SAY (E L (E L) O))
;; CG-USER(42): (nsubst 'a 'e Tree)
;; (I SAY (A L (A L) O))
;; CG-USER(43): Tree
;; (I SAY (A L (A L) O))


(defvar *Things* '((object1 large green shiny cube)
(object2 small red dull metal cube)))

(defun rename (Obj NewName)
(setf (car (assoc Obj *Things*)) NewName))

(defun addProperty (Obj Property)
(nconc (assoc Obj *Things*) (list Property)))



;; CG-USER(55): (addProperty 'object1 'triangle)
;; (OBJECT1 LARGE GREEN SHINY CUBE TRIANGLE)
;; CG-USER(56): (rename 'object1 'A)
;; A
;; CG-USER(57): (addProperty 'A 'purple)
;; (A LARGE GREEN SHINY CUBE TRIANGLE PURPLE)
;; CG-USER(58): (rename 'object2 'B)
;; B
;; CG-USER(59): (addProperty 'B 'Octagon)
;; (B SMALL RED DULL METAL CUBE OCTAGON)
;; CG-USER(60): *Things*
;; ((A LARGE GREEN SHINY CUBE TRIANGLE PURPLE) (B SMALL RED DULL METAL CUBE OCTAGON))


728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️


📖 Contents 📖