aboutsummaryrefslogtreecommitdiff
path: root/chap5/part3.rkt
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-05 16:34:32 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-05 16:34:32 -0600
commit783fa44e5b1754586fce3f69ea89eca5b8d28170 (patch)
tree966ac8f71a828e2b56c1c385aebff197d98dd402 /chap5/part3.rkt
parenta0b197cc68e42568aeadaf94d7ec631ffc4b3cca (diff)
Finish chapter 5 part 5HEADmaster
Diffstat (limited to 'chap5/part3.rkt')
-rw-r--r--chap5/part3.rkt5
1 files changed, 5 insertions, 0 deletions
diff --git a/chap5/part3.rkt b/chap5/part3.rkt
index 2fad35d..cf6cc92 100644
--- a/chap5/part3.rkt
+++ b/chap5/part3.rkt
@@ -143,6 +143,11 @@
(goto (reg continue))
append-done))
+(define (last-pair x)
+ (if (null? (cdr x))
+ x
+ (last-pair (cdr x))))
+
(#%provide append!)
(define (append! x y)
(set-cdr! (last-pair x) y)