Skip to content

Instantly share code, notes, and snippets.

Last active December 27, 2015 03:09
What would you like to do?
return the elements of a list with an odd index (1, 3, 5, etc.)
(define (odds lis)
(reverse (odds-reduce lis '())))
(define (odds-reduce l1 l2)
((null? l1) l2)
((= (length l1) 1) (cons (car l1) l2))
(else (odds-reduce (cddr l1) (cons (car l1) l2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment