UNB/ CS/ David Bremner/ teaching/ cs4613/ tutorials/ Lab Tutorial 4

Header



Checker

(check: :language  '(module plait)
        :coverage? #t
        :output    output-file
        :maxwidth 120
        (*test (equal? (cycle (Empty)) (Empty)) #t)
        (*test (take 0 big-mlist) '())
        (*test (take 0 small-cycle) '())
        (*test (take 5 big-cycle) '(0 1 2 3 4))
        (*test (take 5 small-cycle) '(0 1 2 0 1))
        (*test (take 107 big-cycle) (build-list 107 (lambda (n) (modulo n 50))))
        (*test (take 6 test-lst1) '(1 2 3 4 5 6))
        (*test (take 3 test-lst2) '(4 5 6))
        (*test (take 1000 test-lst1) '(1 2 3 4 5 6)))

(post: (-receipt users))

Notes

the solution contains some improvements related to the original lab, in particular mutating and non-mutating versions of the cycle function