我正在編寫函數try-weak-cues
,以從大量響應中選擇響應。這個程序本質上是與用戶的對話。錯誤的語法(標識符後的多個表達式)
(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*))))
下面是響應列表的功能應該由拉:
(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))))
))
錯誤:
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))
非常感謝您的幫助! – user2852171
@ user2852171不客氣!如果我的回答對你有幫助,請點擊左側的複選標記,考慮[接受](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) ;) –