Maybe it would make sense to limit it to certain functions. For example, if you are reading ``An Introduction to Programming in Emacs Lisp'', you would want to be quizzed only for the functions that were mentioned in the chapters you have finished. The same could be done for the reference manual. Studying a single package from ELPA might also make sense.
As an alternative I thought that unit tests could be also used. For example, here's a snippet from rot13-tests.el
:
(ert-deftest rot13-tests-rot13-string ()
(should (equal (rot13-string "") ""))
(should (equal (rot13-string (rot13-string "foo")) "foo"))
(should (equal (rot13-string "Super-secret text")
"Fhcre-frperg grkg")))
This could easily be split into just the parts inside the should
. You could randomly replace a value with a special symbol (*HIDDEN*
or something), and let the user guess what was the original value. The user could supply an alternative solution, but it can be evaluated and accepted if it is equivalent. The bigger issue is that most tests are more involved, they need special buffers and variables, or mention the function tested in the example inputs, etc.
I remember there was some package that would work like Smalltalk's Finder and list you possible functions to use if you have given it the inputs and the desired output. Maybe something like that could be used to generate questions? But generating random inputs is probably a harder problem than finding the function.