Skip to content

Instantly share code, notes, and snippets.

@klandergren
Forked from gvinter/gist:1034982
Created June 20, 2011 01:42
Show Gist options
  • Select an option

  • Save klandergren/1035005 to your computer and use it in GitHub Desktop.

Select an option

Save klandergren/1035005 to your computer and use it in GitHub Desktop.
Does alist contain x?
;; think on this:
;; contains-incomplete returns 0 if it doesn't find
;; the val and greater than 0 if it does
(define (contains-incomplete val list)
(fold-left (lambda (a x) (YOUR CODE) 0 list))
;; testing
(contains-incomplete 0 '(1 2 3)) ;; => 0
(contains-incomplete 1 '(1 2 3)) ;; => 1
(contains-incomplete 2 '(1 2 3)) ;; => 1
(contains-incomplete 3 '(1 2 3)) ;; => 1
(RESTART 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment