Created
September 11, 2012 23:34
-
-
Save colinpilloud/3703026 to your computer and use it in GitHub Desktop.
Mutually recursive Racket functions to retrieve every other element from a list.
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
| (define (even lst) | |
| (cond | |
| [(empty? lst) empty] | |
| [else (cons (car lst) (odd (cdr lst)))] | |
| ) | |
| ) | |
| (define (odd lst) | |
| (cond | |
| [(empty? lst) empty] | |
| [else (even (cdr lst))] | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment