Begin Exercise 2.29

This commit is contained in:
Tobias Eidelpes 2022-11-08 21:56:46 +01:00
parent edf806a655
commit 29504b7294

View File

@ -161,3 +161,22 @@ and upper bound."
(if (null l) (if (null l)
() ()
(append (deep-reverse (cdr l)) (list (car l))))) (append (deep-reverse (cdr l)) (list (car l)))))
;; Exercise 2.29
(defun make-mobile (left right)
(list left right))
(defun left-branch (mobile)
(car mobile))
(defun right-branch (mobile)
(cdr mobile))
(defun make-branch (length structure)
(list length structure))
(defun branch-length (branch)
(car branch))
(defun branch-structure (branch)
(cdr branch))