Skip to content

Instantly share code, notes, and snippets.

@gvinter
Created June 20, 2011 01:16
Show Gist options
  • Save gvinter/1034982 to your computer and use it in GitHub Desktop.
Save gvinter/1034982 to your computer and use it in GitHub Desktop.
Does alist contain x?
(define (contains x alist)
(define (foldl f(x accum) alist)
(null? alist)
#false
(if (= (car alist) x)
#true
(foldl f(x accum) (cdr alist))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment