Ah, that's because the "python" is actually just using javascript evals.
} else if (mode === 'python') {
if (cmd === 'exit()') { mode = 'sh'; }
else {
try {
// Safe(ish) eval for demo purposes.
// In production, never use eval. Use a JS parser library.
// Mapping JS math to appear somewhat pythonesque
let result = eval(cmd);
if (result !== undefined) output(String(result));
} catch (e) {
output(`Traceback (most recent call last):\n File "<stdin>", line 1, in <module>\n${e.name}: ${e.message}`, true);
}
}
Somewhat amusing 4th wall breaking if you open Python from the terminal in the fake Windows. Examples:
1. If you try to print something using the "Python" print keyword, it opens a print dialog in your browser.
2. If you try to open a file using the "Python" open keyword, it opens a new browser tab trying to access that file.
That is, it's forwarding the print and open calls to your browser.
The part about dad joke square theory got me thinking about this classic scarecrow joke, which feels like an example from some higher order version of square theory:
"Why was the scarecrow given an award?"
"He was out standing in his field."
The fact that a scarecrow's job is to be "out standing in his field", and that excelling at one's job can be phrased as being "outstanding in his field" is an incredible linguistic coincidence.
I am told that an interesting alternative is the Structured State Space for Sequence Modeling (S4). I don't personally know much about this technique, but didn't see anybody else mention this in this thread.
I had him as a teaching assistant when I was teaching data structures at Princeton back in Fall 2013. Princeton CS has their professors rotate through as TAs every so often through their courses.
That semester, I made a slight mistake on the final exam where I asked students to create an algorithm that could find the second shortest path from s to every other vertex in a graph. I forgot to specify that the second shortest path should be simple (i.e. should not reuse any vertex twice). Having to deal with non-simple paths makes the problem much much harder.
None of the students figured it out in the time available, and I'm sure I would also have been stumped if I had tried to solve the problem. Bob figured it out though. And then I remember he graded all 150 solutions to the problem himself, having as a blast as he went through students attempts at an effectively impossible problem.
That was interesting. I asked it to try to say something in another language, and she read it in a thick American accent. No surprise. Then I asked her to sing, and she said something like "asterisk in a robotic singing voice asterisk...", and then later explained that she's just text to speech. Ah, ok, that's about what I expected.
But then I asked her to integrate sin(x) * e^x and got this bizarre answer that started out as speech sounds but then degenerated into chaos. Out of curiosity, why and how did she end up generating samples that sounded rather unlike speech?
} else if (mode === 'python') { if (cmd === 'exit()') { mode = 'sh'; } else { try { // Safe(ish) eval for demo purposes. // In production, never use eval. Use a JS parser library. // Mapping JS math to appear somewhat pythonesque let result = eval(cmd); if (result !== undefined) output(String(result)); } catch (e) { output(`Traceback (most recent call last):\n File "<stdin>", line 1, in <module>\n${e.name}: ${e.message}`, true); } }