I think new learners find those are easier to approach than full scripts, but they don't fit with the live coding approach. A hybrid approach would be to add a REPL mode that lets the user type new lines at the end of each code sample. Ideally, the up arrow would even let them cycle through the lines in the sample.
The code module has tools to emulate a REPL, including help deciding when an expression is complete and when you should ask for another line.
It might be possible to fit this into the live tutorial model using cloze tests. The goal could be a REPL session with blanks, and the student has to follow the pattern and fill in the blanks. For example, a goal might look like this:
>>> a = 2
>>> b = 3
>>> a ? b
6
The student would need to replace the ? with *. I guess a rewind button would be needed to fix mistakes.
To define a REPL section, end the code with >>>. The goal can contain lines that start with ^^^ to mark clozes.
>>> a = 2
>>> b = 3
>>>
### Goal ###
>>> a = 2
>>> b = 3
>>> a * b
^^^ ^
6
While reviewing tutorials for #262, I found a lot of them use the REPL at the start. A typical example:
Some of them use multiline expressions:
I think new learners find those are easier to approach than full scripts, but they don't fit with the live coding approach. A hybrid approach would be to add a REPL mode that lets the user type new lines at the end of each code sample. Ideally, the up arrow would even let them cycle through the lines in the sample.
The
code
module has tools to emulate a REPL, including help deciding when an expression is complete and when you should ask for another line.It might be possible to fit this into the live tutorial model using cloze tests. The goal could be a REPL session with blanks, and the student has to follow the pattern and fill in the blanks. For example, a goal might look like this:
The student would need to replace the
?
with*
. I guess a rewind button would be needed to fix mistakes.To define a REPL section, end the code with
>>>
. The goal can contain lines that start with^^^
to mark clozes.