tweak lab4 syntax

This commit is contained in:
Isaac Shoebottom 2025-02-05 10:54:58 -04:00
parent fe11450530
commit add499872f

View File

@ -36,7 +36,7 @@
[(MPair n t)
(type-case MList (unbox t)
[(Empty) (set-box! t lst2)]
[else (set-last! (unbox t) lst2)])]
[else (set-last! (unbox t) lst2)])]
[(Empty) (error 'empty "cannot set tail")]))
(define test-lst1 (mlist '(1 2 3)))
@ -50,8 +50,8 @@
; cycle
(define (cycle lst)
(type-case MList lst
[(MPair n t) (begin (set-last! lst lst) lst)]
[(Empty) (Empty)]))
[(Empty) (Empty)]
[else (begin (set-last! lst lst) lst)]))
(define small-cycle (cycle (mlist '(0 1 2))))
(define big-cycle (cycle big-mlist))