;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname my-append) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) ; my-append : (list-of α), (list-of α) -> (list-of α) ; return a list with the elements of `a` tacke on to the front of `b` ; (define (my-append a b) (cond [(empty? a) b] [(cons? a) (cons (first a) (my-append (rest a) b))])) (check-expect (my-append '() '()) '()) (check-expect (my-append '() (list 1)) (list 1)) (check-expect (my-append '() (list 1 2 3)) (list 1 2 3)) (check-expect (my-append (list 1) '()) (list 1)) (check-expect (my-append (list 1 2 3) '()) (list 1 2 3)) (check-expect (my-append (list 1) (list 2)) (list 1 2)) (check-expect (my-append (list 1 2) (list 3)) (list 1 2 3)) (check-expect (my-append (list 1) (list 2 3)) (list 1 2 3)) (check-expect (my-append (list 1 2 3) (list 4 5 6)) (list 1 2 3 4 5 6))