Handbook
Glossary
generate-question ( question -- )
Vocabulary
quiz
Inputs
question
an
object
Outputs
None
Definition
IN:
quiz
GENERIC:
generate-question
( question -- )
Methods
USING:
accessors
assocs
combinators
kernel
quiz
random
sequences
sequences.extras
;
M:
multiple-choice-question
generate-question
dup
generate-question*
[
random
>>generated
]
[
[
( -- answer )
call-effect
]
map
alphabet-zip
>>choices
]
bi
dup
[
choices>>
]
[
generated>>
( -- answer )
call-effect
]
bi
[
[
second
]
]
dip
[
=
]
curry
compose
find-all
values
keys
>>answer
drop
;
USING:
quiz
;
M:
number-response
generate-question
<number-question>
generate-question
;
USING:
kernel
quiz
;
M:
object
generate-question
generator-needs-reponse-type
;
USING:
accessors
combinators
kernel
quiz
;
M:
question
generate-question
dup
generate-question*
[
>>generated
]
keep
( -- answer )
call-effect
>>answer
drop
;
USING:
quiz
;
M:
string-response
generate-question
<string-question>
generate-question
;