Companion object: constants and IO helpers shared across the REPL entry point.
Attributes
Members list
Type members
Classlikes
A binned sample — see Session.histogramBins (F_0135).
A binned sample — see Session.histogramBins (F_0135).
Value parameters
- counts
-
the
kcounts - edges
-
the
k + 1bin edges, ascending - expr
-
the sample as the user typed it, for labelling the figure
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A root locus — see Session.rootLocusPoints (F_0140).
A root locus — see Session.rootLocusPoints (F_0140).
Value parameters
- branches
-
one sequence of
(re, im)closed-loop poles per branch, in gain order - expr
-
the plant as the user typed it
- poles
-
the open-loop poles
- variable
-
the frequency variable
- zeros
-
the open-loop zeros
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A completed sampling: the points, and the text they came from.
A completed sampling: the points, and the text they came from.
The two strings are carried because a plot has to say what it is showing — they title the axes — and the alternative was for the caller to split the command a second time to recover them. A second parse of the same text is exactly the sort of duplicate this codebase removes on sight: the two could disagree, and then a figure would be labelled with something other than what it plots.
Value parameters
- expr
-
the expression as the user typed it
- points
-
the
(x, y)pairs, with non-finite results already dropped - variable
-
the name sampled over
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A completed frequency sweep: (omega, magnitude-in-dB, unwrapped-phase-in-degrees).
A completed frequency sweep: (omega, magnitude-in-dB, unwrapped-phase-in-degrees).
Distinct from Samples because a Bode diagram is two curves over one shared frequency axis, not one curve; flattening it to pairs would lose the pairing that makes the two panels line up.
Value parameters
- expr
-
the plant as the user typed it
- points
-
the swept response, ascending in omega
- variable
-
the frequency variable
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Returns the help text for a specific topic, or the full help listing when not found.
Returns the help text for a specific topic, or the full help listing when not found.
Value parameters
- topic
-
the command token to look up (e.g.
"simplify",":=")
Attributes
- Returns
-
topic-specific text, or
helpwhen the topic is unknown
Whether ch can appear inside an identifier — the grammar's own shape, underscore included.
Whether ch can appear inside an identifier — the grammar's own shape, underscore included.
Written out because isLetterOrDigit alone is not that test: my_func(2) was reported as 'func', since the regex stopped at the underscore and the guard then saw a non-alphanumeric before f and let it through.
Attributes
Reads a saved session and replays it. Backs :load.
Reads a saved session and replays it. Backs :load.
The storage medium is platform-specific; this dispatch is not (issue F_0003 phase 2). SessionIO is a file path on the JVM and a localStorage key in the browser, so :load work means the same thing in both and only the medium differs. What made that cheap is that Session.load was already pure string-in: the file system was the only JVM-bound part of the command, and it was never inside Session.
Value parameters
- path
-
the session name — a file path on the JVM, a storage key in a browser
- session
-
the session to replay the script into
Attributes
- Returns
-
the script's own output, or a message explaining why it could not be read
Writes the session's replayable script. Backs :save; see loadFile on storage.
Writes the session's replayable script. Backs :save; see loadFile on storage.
Value parameters
- path
-
the session name — a file path on the JVM, a storage key in a browser
- session
-
the session to serialise
Attributes
- Returns
-
a confirmation, or a message explaining why it could not be written
Interprets one line read by the REPL loop, resolving the commands execute cannot: the file-IO :load/:save and the quit/exit sentinels. A None line stands for end-of-input (Ctrl-D). Returns None to stop the loop, or Some(output) to continue — output is the (possibly empty) text to print. This keeps the loop's dispatch logic unit-testable; only the JLine plumbing in repl() is interactive-only.
Interprets one line read by the REPL loop, resolving the commands execute cannot: the file-IO :load/:save and the quit/exit sentinels. A None line stands for end-of-input (Ctrl-D). Returns None to stop the loop, or Some(output) to continue — output is the (possibly empty) text to print. This keeps the loop's dispatch logic unit-testable; only the JLine plumbing in repl() is interactive-only.
Value parameters
- line
-
the input line, or
Nonefor end-of-input - session
-
the active
Sessionthat accumulates state
Attributes
- Returns
-
Noneto terminate the loop;Some(output)to continue
Concrete fields
An identifier written immediately before ( (issue F_0030).
An identifier written immediately before ( (issue F_0030).
The identifier shape is the grammar's own ([a-zA-Z][a-zA-Z0-9]*). No whitespace is permitted before the bracket: that is what separates an attempted function call from an ordinary parenthesised product, which the grammar spells the same way and which a user should not be lectured about.
There is deliberately NO lookbehind here, although (?<![a-zA-Z0-9]) expresses the "not part of a longer name" rule directly and was how this was first written. Scala.js's java.util.regex emulation refuses a lookbehind at the ES version this project targets — PatternCompiler.parseErrorRequireESVersion — and the failure is at runtime, when the pattern is first compiled, so it takes out every browser test that touches Session rather than failing to compile. Consuming the preceding character instead would be portable but wrong: findAllMatchIn resumes after the previous match, so the ( of sqrt(foo(x)) would be eaten and the inner foo( missed. The caller checks the character before start itself, which is exact on both platforms.
Attributes
The words a line opens with to give a command rather than an expression (F_0213): what the highlighter colours as a command, kept beside the dispatch that reads them. Every one is in Parser.ReservedWords, so no binding can take one.
The words a line opens with to give a command rather than an expression (F_0213): what the highlighter colours as a command, kept beside the dispatch that reads them. Every one is in Parser.ReservedWords, so no binding can take one.
Attributes
Points taken by samples / Session.samplePoints when the count is omitted.
Points taken by samples / Session.samplePoints when the count is omitted.
Named rather than inlined because it is now read by two renderings of one sampling — the printed table and the browser's plot — and a plot drawn at a different default density from the table beside it would be quietly confusing.
Attributes
The most points any of the sweeping commands will sample.
The most points any of the sweeping commands will sample.
Generous for a figure and far below what hurts: no screen resolves 100 000 points, while the grid is materialised in full before anything is drawn — so an uncapped count is an OutOfMemoryError, and that is one of the two throwables the REPL deliberately lets propagate. A mistyped digit would therefore end the session rather than be reported (issue F_0022). The MaxTabulateTerms precedent: computable in principle is not should be attempted.
Attributes
The most digits exact precision will approximate an irrational to.
The most digits exact precision will approximate an irrational to.
The same rule as MaxSampleCount, costing time rather than memory. The irrational kernels compute to whatever precision they are asked for, so an uncapped setting is an unbounded computation the session cannot be talked out of: at a terminal only Ctrl-C ends it, and in the browser nothing does — and there it is reachable by a third party, since exact precision is part of Session.settings, script writes it, and the page replays a shared link's script on load (issue F_0041).
1000 is measured, not chosen for roundness. One pi*e on the JVM costs, by digits: 100 → 0.1 s, 250 → 0.2 s, 500 → 0.5 s, 1000 → 2 s, 2000 → 11 s, 4000 → 60 s — worse than quadratic, near n^2.4, so 10 000 is upwards of ten minutes and would have been a ceiling that bounds nothing. 1000 holds a single evaluation to about two seconds while sitting 33× above the default of 30 and far beyond the largest precision any example in this project uses; Scala.js is slower still, which argues the same way.
It is deliberately NOT MaxExactFactorial's 10 000: sharing a number across caps whose cost curves differ would make the figure look considered when it is only consistent.
Attributes
Names the parser always resolves as constants; assignment to them is rejected.
Names the parser always resolves as constants; assignment to them is rejected.
Attributes
The full command-summary listing printed by help with no argument.
The full command-summary listing printed by help with no argument.
Attributes
Per-command help text, keyed by the command token (:=, simplify, ...). Returned by help; bare help still shows the full help listing.
Per-command help text, keyed by the command token (:=, simplify, ...). Returned by help; bare help still shows the full help listing.