我正在编写一个函数,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*))))
Run Code Online (Sandbox Code Playgroud)
下面是该函数应该从中获取的响应列表:
(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) …Run Code Online (Sandbox Code Playgroud) 我似乎在删除结构列表中的重复项时遇到了一些问题.
这是结构的一个例子:
struct item
{
String name;
int index;
String type;
}
Run Code Online (Sandbox Code Playgroud)
我想这样做,以便从列表中删除具有相同名称,索引和类型的项目,并且我想在清除其他方法的重复项后使用相同的列表,我只是不完全确定如何做这个.