From 11629be62a5598e8a4545785c2556c5779fb12cd Mon Sep 17 00:00:00 2001 From: Mike Small Date: Wed, 7 Oct 2020 23:38:00 -0400 Subject: [PATCH] Explicitly set input channel This seems to be necessary, though I don't see it written clearly why in docs. --- citizenship.l | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) mode change 100644 => 100755 citizenship.l diff --git a/citizenship.l b/citizenship.l old mode 100644 new mode 100755 index 8dfd343..e78b0ed --- a/citizenship.l +++ b/citizenship.l @@ -1,5 +1,7 @@ #!/usr/local/bin/picolisp /usr/local/lib/picolisp/lib.l +(setq *Testlen 2) + (setq *Questions '(((How old do citizens have to be to vote for President?) (18) ) @@ -17,3 +19,21 @@ ((= Answer Actual) '(T "Exactly right")) (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)