I am writing a function, try-weak-cues
, to select a response from a large set of responses. This program is essentially a conversation with the user.
(define try-weak-cues
(lambda (sentence context)
(define helper
(lambda(list-of-pairs)
(define helper2
(lambda(list-of-pairs context)
(cond((null? list-of-pairs)
(cond((null? list-of-pairs) '())
((any-good-fragments?(cue-part(car list-of-pairs))sentence) (helper2(cdr(car list-of-pairs))context))
(else(helper(cdr list-of-pairs)))))))))
(helper *weak-cues*))))
Below is the list of responses that the function is supposed to pull from:
(define *weak-cues*
'( ( ((who) (whos) (who is))
((first-base)
((thats right) (exactly) (you got it)
(right on) (now youve got it)))
((second-base third-base)
((no whos on first) (whos on first) (first base))) )
( ((what) (whats) (what is))
((first-base third-base)
((hes on second) (i told you whats on second)))
((second-base)
((right) (sure) (you got it right))) )
( ((whats the name))
((first-base third-base)
((no whats the name of the guy on second)
(whats the name of the second baseman)))
((second-base)
((now youre talking) (you got it))))
))
The error:
define: bad syntax (multiple expressions after identifier) in: (define helper (lambda (list-of-pairs) (define helper2 (lambda (list-of-pairs context) (cond ((null? list-of-pairs) (cond ((null? list-of-pairs) (quote ())) ((any-good-fragments? (cue-part (car list-of-pairs)) sentence) (helper2 (cdr (car list-of-pairs)) context)) (else (helper (cdr list-of-pairs))))))))) (helper weak-cues))