Skip to content

Instantly share code, notes, and snippets.

@jbclements
Forked from MattS8/gist:7650837
Last active December 29, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbclements/7650850 to your computer and use it in GitHub Desktop.
Save jbclements/7650850 to your computer and use it in GitHub Desktop.
;; 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