scheme - Records search function -


i have problem medical database in scheme. want write function takes x symptoms , searches through database match diagnose.

this i've done far:

(define helper-match    (lambda (ls)    (reverse     (let loop ([ls ls] [found '()] [acc '()])      (cond       [(null? ls)         acc]       [(memq (car ls) found)         (loop (cdr ls)               found               (if (memq (car ls) acc)                   acc                   (cons (car ls) acc)))]       [else         (loop (cdr ls)               (cons (car ls) found)               acc)])))))    

above function check duplicates don't know how write compares database.

the structure of database looks this:

(define *medical-db-2* '((1  (disease (meningit)  (symptom (fever) (headache) (vertigo) (vomiting) (stiffness) (light sensitivity)))) (2  (disease (encefalit)  (symptom (fever) (headache) (vertigo) (vomiting) (disorientation) (cramps)))) 


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -