Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Collection Operations
; Collection Operations
(define (map proc items)
(if (null? items)
null
(cons (proc (car items))
(map proc (cdr items)))))
(define (filter condition items)
(if (null? items)
null
(if (proc (car items))
(cons (car items) (filter condition (cdr items)))
(filter condition (cdr items)))))
(define (append seq1 seq2)
(if (null? seq1)
seq2
(cons (car seq1) (append (cdr seq1) seq2))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.