An Introduction to Programming in Emacs Lips Chapter 07

Chapter 07

  • car
    • Contents of the Address part of Register
  • cdr
    • Contents of the Decrement part of the Register
      • この語源は,今となっちゃ irrelevant
    • could-erと発音
    • 日本語にすると,クダァか。
  • cons
    • construct
    • 「コンス」?「コンズ」?
    • 「コンスとラクト」だから,「コンス」と発音すると推測。
  • 関連する関数
    • length
      • (length '()) => 0
    • nthcdr
      • (nthcdr 2 'list)
        • (cdr (cdr 'list))
      • (nthcdr 100 '()) => nil
    • nth
      • (car (nthcdr 'list))
    • setcar
      • destructive
    • setcdr
      • destructive

Exercise

;;; Exercise 7.7
(cons 'owl (cons 'crow (cons 'sparrow (cons 'swallow ()))))
;; => (owl crow sparrow swallow)
(let ((birds '(owl crow sparrow swallow)))
  (cons birds birds))
;; => ((owl crow sparrow swallow) owl crow sparrow swallow)
(let ((birds '(owl crow sparrow swallow)))
  (setcar birds 'carp)
  birds)
;; => (carp crow sparrow swallow)
(let ((birds '(owl crow sparrow swallow)))
  (setcar birds 'carp)
  (setcdr birds '(salmon tuna sardine))
  birds)
;; => (carp salmon tuna sardine)