Explicitly set input channel
This seems to be necessary, though I don't see it written clearly why in docs.
This commit is contained in:
parent
c0f3006a7f
commit
11629be62a
20
citizenship.l
Normal file → Executable file
20
citizenship.l
Normal file → Executable file
@ -1,5 +1,7 @@
|
|||||||
#!/usr/local/bin/picolisp /usr/local/lib/picolisp/lib.l
|
#!/usr/local/bin/picolisp /usr/local/lib/picolisp/lib.l
|
||||||
|
|
||||||
|
(setq *Testlen 2)
|
||||||
|
|
||||||
(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) )
|
||||||
@ -17,3 +19,21 @@
|
|||||||
((= Answer Actual) '(T "Exactly right"))
|
((= Answer Actual) '(T "Exactly right"))
|
||||||
(T '(NIL "Wrong or unrecognized")) ) ) )
|
(T '(NIL "Wrong or unrecognized")) ) ) )
|
||||||
|
|
||||||
|
(seed (time))
|
||||||
|
(setq *Test (make (do *Testlen (NIL *Questions)
|
||||||
|
(let (N (rand 1 (length *Questions)))
|
||||||
|
(link (get *Questions N))
|
||||||
|
(setq *Questions (remove N *Questions)) ) ) ) )
|
||||||
|
|
||||||
|
(setq *Right 0)
|
||||||
|
|
||||||
|
(mapc '((Q)
|
||||||
|
(in NIL
|
||||||
|
(let (A (ask Q))
|
||||||
|
(when (car A)
|
||||||
|
(inc '*Right) )
|
||||||
|
(prinl (cadr A)) ) ) )
|
||||||
|
*Test)
|
||||||
|
|
||||||
|
(msg 'Score: " " *Right '/ *Testlen)
|
||||||
|
(bye)
|
||||||
|
Loading…
Reference in New Issue
Block a user