add ask fn and change representation
Using lists of symbols instead of strings may help when recognizing answers that are right but not textually identical.
This commit is contained in:
parent
881e949ed5
commit
c0f3006a7f
@ -1,11 +1,19 @@
|
|||||||
#!/usr/local/bin/picolisp /usr/local/lib/picolisp/lib.l
|
#!/usr/local/bin/picolisp /usr/local/lib/picolisp/lib.l
|
||||||
|
|
||||||
(setq *Questions
|
(setq *Questions
|
||||||
(("How old do citizens have to be to vote for President?"
|
'(((How old do citizens have to be to vote for President?)
|
||||||
"18" )
|
(18) )
|
||||||
("What happened at the Constitutional Convention?"
|
((What happened at the Constitutional Convention?)
|
||||||
"The Constitution was written" )
|
(The Constitution was written) )
|
||||||
("Where is the Statue of Liberty?"
|
((Where is the Statue of Liberty?)
|
||||||
"New York Harbor")
|
(New York Harbor) )
|
||||||
) )
|
) )
|
||||||
|
|
||||||
|
(de ask (Question)
|
||||||
|
(prinl (str (car Question)))
|
||||||
|
(let (Answer (str (line T))
|
||||||
|
Actual (cadr Question))
|
||||||
|
(cond
|
||||||
|
((= Answer Actual) '(T "Exactly right"))
|
||||||
|
(T '(NIL "Wrong or unrecognized")) ) ) )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user