start mzc scribbling

svn: r8334

original commit: 8b16cee613d8ea3258c98e2e4c98b3756ae04019
This commit is contained in:
Matthew Flatt 2008-01-15 13:09:40 +00:00
parent 317205cbed
commit dbd9978f63

View File

@ -8,6 +8,7 @@
mappend
mappend!
mreverse
mreverse!
mlist-tail
mlist-ref
mmemq
@ -103,10 +104,11 @@
(case-lambda
[() null]
[(a) a]
[(a b) (let loop ([atail a])
(cond [(null? atail) b]
[(null? (mcdr atail)) (set-mcdr! atail b) a]
[else (loop (mcdr atail))]))]
[(a b) (if (null? a)
b
(let loop ([atail a])
(cond [(null? (mcdr atail)) (set-mcdr! atail b) a]
[else (loop (mcdr atail))])))]
[(a . l) (mappend! a (apply mappend! l))]))
(define (mreverse l)
@ -115,6 +117,14 @@
[(null? l) a]
[else (loop (mcdr l) (mcons (mcar l) a))])))
(define (mreverse! l)
(let loop ([l l][prev null])
(cond
[(null? l) prev]
[else (let ([next (mcdr l)])
(set-mcdr! l prev)
(loop next l))])))
(define (mlist-tail l n)
(cond
[(zero? n) l]