Skip to content

Instantly share code, notes, and snippets.

@WillNess
Forked from roerd/rev.scm
Created November 13, 2013 20:56
Show Gist options
  • Save WillNess/7456254 to your computer and use it in GitHub Desktop.
Save WillNess/7456254 to your computer and use it in GitHub Desktop.
(define (rev lst)
(if (or (null? lst)
(null? (cdr lst)))
lst
(apply (lambda (x . xs)
(apply (lambda (y . ys)
(cons y (rev (cons x (rev ys)))))
(rev xs)))
lst)))
@WillNess
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment