sloisel / numeric

Numerical analysis in Javascript
http://www.numericjs.com/
Other
1.42k stars 177 forks source link

Add commands to workshop to access history of previous statements and results #27

Closed darcyparker closed 11 years ago

darcyparker commented 11 years ago

I am only suggesting adding this to workshop and not numeric.js itself. I would like to be able to access the last statement or second last statement etc, without copy/paste in browser.

For example, maybe pressing the up/down keys would allow me to move through the history of previous statements so that I can execute them again, or edit them before executing them.

Another notation for referencing previous results would be nice too... but this would involve writing a parser (perhaps with http://pegjs.majda.cz/) or a simple substitution with a regex, that pre-processes a statement and substitutes prior results. For example !! could refer to the last result, !n could refer to statement from line n, and !-n could refer to the last nth statement.

Accessing prior results is not as important to me... but I think navigating prior statements would be useful.

sloisel commented 11 years ago

The computation model for the Workshop is a Worksheet, like MAPLE and SAGE. In such an environment, each text box can contain multi-line programs. In order to enter a multi-line program, use the shift-enter combination (this is the same as MAPLE). Thus, each text entry box is conceptually a text editor and the cursor keys (including up/down) work as they would in an ordinary text editor.

Note that a Worksheet is quite different from a console. If one were to implement a console environment for numeric.js, it would make sense to have a command history and use the cursor keys to navigate this command history. I don't think that this approach is consistent with the Worksheet concept, however.

darcyparker commented 11 years ago

Thanks for the clarification.