Skip to content

Instantly share code, notes, and snippets.

@ecounysis
Created March 28, 2010 20:03
Show Gist options
  • Save ecounysis/346992 to your computer and use it in GitHub Desktop.
Save ecounysis/346992 to your computer and use it in GitHub Desktop.
(define even?
(lambda (x)
(cond ((= x 0) #t)
(else (odd? (- x 1))))))
(define odd?
(lambda (x)
(cond ((= x 0) #f)
(else (even? (- x 1))))))
(define list-ref
(lambda (ls pos)
(cond ((= pos 0) (car ls))
(else (list-ref (cdr ls) (- pos 1))))))
(define list-tail
(lambda (ls pos)
(cond ((= pos 0) ls)
(else (list-tail (cdr ls) (- pos 1))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment