Desmos, 51 50 45 bytes
o→\left\{i=0:[0],join(1,o!)\right\}
i=0
o=0
Try It Online! (Click the play button on the ticker up top (metronome icon) to run the program)
Desmos doesn't exactly have standard I/O support, but this should get the point across. Input is the i variable, output is the o variable. Each line is a separate expression, and the first expression needs to be in the ticker, as shown in the TIO.
Addendum: at the very least, this output method is accepted by default. Not sure about the input.
EDIT: a surprising -1, apparently →
parses properly as an action! Unfortunately, it still costs 3 bytes, which is the same as \to
, BUT it allows me to change \to join
to →join
since the parser gets confused by \tojoin
EDIT: -5 thanks to zygan on discord who showed me that an action itself can be piecewise, and also me realizing that o!
is shorter than o^o
and doesn't even have to rely on wacky edge case behavior lol
Old 50 byte solution:
\left\{i=0:o→[0],o→join(1,o^o)\right\}
i=0
o=0
Try It Online! (Click the play button on the ticker up top (metronome icon) to run the program)
Old 51 byte solution:
\left\{i=0:o\to[0],o\to join(1,o^o)\right\}
i=0
o=0
Try It Online! (Click the play button on the ticker up top (metronome icon) to run the program)