Qu

explore

Builtin index · Plotting

explore("fn", path, names=, from=, to=, steps=)

Input: "fn", path, names, from, to, steps · Output: no output

What it is

Writes a self-contained HTML page to path (string) with one slider per parameter of function "fn" (string). names= (List of strings, slider labels), from=/to= (Lists/tuples of numbers, per-parameter ranges), steps= (List of integers, per-parameter step counts) are parallel, one entry per parameter. Every combination is rendered up front (capped at 400 total), because a browser cannot run Qu.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
explore("fn", path, names=, from=, to=, steps=)
"fn" stringWrites a self-contained HTML page to path (string) with one slider per parameter of function "fn" (string).
path stringWrites a self-contained HTML page to path (string) with one slider per parameter of function "fn" (string).
names List, string, or numbernames= (List of strings, slider labels), from=/to= (Lists/tuples of numbers, per-parameter ranges), steps= (List of integers, per-parameter step counts) are parallel, one entry per parameter.
from List, string, or numbernames= (List of strings, slider labels), from=/to= (Lists/tuples of numbers, per-parameter ranges), steps= (List of integers, per-parameter step counts) are parallel, one entry per parameter.
to stringWrites a self-contained HTML page to path (string) with one slider per parameter of function "fn" (string).
steps List, string, or numbernames= (List of strings, slider labels), from=/to= (Lists/tuples of numbers, per-parameter ranges), steps= (List of integers, per-parameter step counts) are parallel, one entry per parameter.
no outputEvery combination is rendered up front (capped at 400 total), because a browser cannot run Qu.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

function view(frequency, damping)
    ...draw...
end function

explore("view", "explorer.html",
        names = ("frequency [Hz]", "damping"),
        from  = (10, 0.02),
        to    = (400, 0.5),
        steps = (12, 8))

not run by the build — this one needs something the repository cannot supply · from plotting

How it works

explore("draw", "out.html", names=, from=, to=, steps=) — a self-contained page with a slider per parameter and the figure updating as they move. The idea, and its limit. There is no Qu in a browser, so the page cannot compute anything: every combination is rendered here, up front, and the sliders CHOOSE among them. That makes the cost the product of the step counts, which is why it is capped -- two parameters at ten steps each is a hundred figures, and three at ten is a thousand, which is not a web page. Within that limit it is the real thing: open the file anywhere, drag, and watch the figure respond with no server, no Qu, and no network. ui_slider is the other half of this story -- it declares a control for a HOST to render, which is right when a host exists and useless when you want to send someone a file.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.