diff options
author | bnewbold <bnewbold@eta.mit.edu> | 2009-05-08 03:45:02 -0400 |
---|---|---|
committer | bnewbold <bnewbold@eta.mit.edu> | 2009-05-08 03:45:02 -0400 |
commit | 4c4b1ef874c75e87e0a8435c73a203e19820ac10 (patch) | |
tree | 3978d72094ab8814b670bde46b14a2d0626e39f6 /final_project/work | |
parent | 2aad489f2c311a8fdfed8419fdf523f055f0296d (diff) | |
download | 6.945-4c4b1ef874c75e87e0a8435c73a203e19820ac10.tar.gz 6.945-4c4b1ef874c75e87e0a8435c73a203e19820ac10.zip |
quicky
Diffstat (limited to 'final_project/work')
-rw-r--r-- | final_project/work/discovery.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/final_project/work/discovery.scm b/final_project/work/discovery.scm index e3756ab..1da7b21 100644 --- a/final_project/work/discovery.scm +++ b/final_project/work/discovery.scm @@ -9,8 +9,6 @@ ; If it isn't already.... ;(load "ghelper") -(define filter keep-matching-items) - ; takes two lists: the first is a set of predicates and the second a set ; of arguments; if any of the predicates are #t for the args, win, else fail (define (for-any? preds args) @@ -175,6 +173,16 @@ (apply discover:apply-name (cons x args))))) names)))) +(define (discover:satisfy pred? . args) + (let try ((objs (list args))) + (let ((goodies (keep-matching-items (lambda (x) (apply pred? x))))) + (if (not (null? goodies)) + (car goodies) + (lp (fold-right append + '() + (map (lambda (x) + (list (apply discover:apply-all x))) + objs))))))) |