Created
November 25, 2013 23:34
-
-
Save MattS8/7650837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; TEAM BYTE ME | |
;; int list -> list | |
;; takes a list and a number and returns a list with the length of the number | |
(define (create_list l n) | |
(cond | |
[(= n 0) empty ] | |
[else (cons (first l) (create_list (rest l) (sub1 n))) | |
])) | |
(check-expect (create_list (cons 1 empty) 0) empty ) | |
(check-expect (create_list (cons 1 (cons 2 empty)) 2) (cons 1 (cons 2 empty)) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment