From 29504b7294656a8a1465222322e14aba9e438df3 Mon Sep 17 00:00:00 2001 From: Tobias Eidelpes Date: Tue, 8 Nov 2022 21:56:46 +0100 Subject: [PATCH] Begin Exercise 2.29 --- chapter2.lisp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/chapter2.lisp b/chapter2.lisp index 86d8c53..f11deae 100644 --- a/chapter2.lisp +++ b/chapter2.lisp @@ -161,3 +161,22 @@ and upper bound." (if (null 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))