Skip to content

Instantly share code, notes, and snippets.

@colinpilloud
Created September 11, 2012 23:34
Show Gist options
  • Select an option

  • Save colinpilloud/3703026 to your computer and use it in GitHub Desktop.

Select an option

Save colinpilloud/3703026 to your computer and use it in GitHub Desktop.
Mutually recursive Racket functions to retrieve every other element from a list.
(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