<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>book/src/web-usage.md - fork/numbat @ v1.7.0</title>
<meta name="description" content="book/src/web-usage.md in fork/numbat at v1.7.0.">
<meta property="og:title" content="book/src/web-usage.md - fork/numbat @ v1.7.0">
<meta property="og:description" content="book/src/web-usage.md in fork/numbat at v1.7.0.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="v1.7.0" data-tip="bbb855bc9bf1f01c8d99861f5b828043e21f799a">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/numbat</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/numbat</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">David Peter</span><span class="commit-message" data-commit="674bda065dab8aed2f6d02de362344753b3731b8">List 'help' and '?' commands in documentation</span><span class="snapshot-sha sha" data-commit="674bda065dab8aed2f6d02de362344753b3731b8">674bda0</span><time datetime="2023-11-03T20:03:05+01:00" title="2023-11-03 20:03:05 +0100">2023-11-03</time></p>
<header class="topbar"><details class="switcher"><summary>v1.7.0</summary><div class="menu"><strong>branches</strong><a href="/fork/numbat/ref/master/">master</a><strong>tags</strong><a href="/fork/numbat/ref/v1.6.0/">v1.6.0</a><a href="/fork/numbat/ref/v1.6.1/">v1.6.1</a><a href="/fork/numbat/ref/v1.6.2/">v1.6.2</a><a href="/fork/numbat/ref/v1.6.3/">v1.6.3</a><a class="current" href="/fork/numbat/ref/v1.7.0/">v1.7.0</a><a href="/fork/numbat/ref/v1.8.0/">v1.8.0</a><a class="all" href="/fork/numbat/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/numbat/">numbat</a> / <a href="/fork/numbat/ref/v1.7.0/tree/book/">book</a> / <a href="/fork/numbat/ref/v1.7.0/tree/book/src/">src</a> / <span class="cur">web-usage.md</span></nav>
<span class="view-stats"><span>2.1 KiB</span><span>59 lines</span></span><span class="actions"><a class="raw" href="/fork/numbat/raw/63635623c4f807c336abf6f5cd3f20b10b3a9c87/book/src/web-usage.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Usage</h1>
<p>The browser-based version of Numbat is available at <a href="https://numbat.dev/">https://numbat.dev/</a>.</p>
<h2>Interactive terminal</h2>
<p>The terminal allows you to perform a sequence of calculations.
You can use the arrow keys to browse through the command history.
The special identifiers <code>ans</code> and <code>_</code> refer to the result of the last calculation. For example:</p>
<pre>&gt;&gt;&gt; 60 kW h / 150 kW

    = 0.4 h

&gt;&gt;&gt; ans -&gt; minutes

    = 24 min
</pre>
<h2>Commands</h2>
<p>There is a set of special commands that only work in the web version:</p>
<table><thead><tr><th>Command</th><th>Action</th></tr></thead><tbody>
<tr><td><code>list</code>, <code>ll</code>, <code>ls</code></td><td>List all constants, units, and dimensions</td></tr>
<tr><td><code>help</code>, <code>?</code></td><td>View short help text</td></tr>
<tr><td><code>reset</code></td><td>Reset state (clear constants, functions, units, …)</td></tr>
<tr><td><code>clear</code></td><td>Clear screen</td></tr>
</tbody></table>
<h2>Key bindings</h2>
<p>In interactive command-line mode, you can use the following key bindings. Most importantly,
<code>Tab</code> for auto-completion, arrow keys and <code>Ctrl-R</code> for browsing the command history, and
<code>Ctrl-D</code> for exiting the interactive session.</p>
<table><thead><tr><th>Key sequence</th><th>Action</th></tr></thead><tbody>
<tr><td><code>Tab</code></td><td>Auto-completion</td></tr>
<tr><td><code>Ctrl</code>-<code>L</code></td><td>Clear screen</td></tr>
<tr><td><code>Up</code>, <code>Down</code></td><td>Browse command history</td></tr>
<tr><td><code>Ctrl</code>-<code>R</code></td><td>Search command history</td></tr>
<tr><td><code>Ctrl</code>-<code>C</code></td><td>Clear the current line</td></tr>
<tr><td><code>Shift</code>-<code>Enter</code></td><td>Insert newline</td></tr>
<tr><td><code>Home</code>, <code>Ctrl</code>-<code>A</code></td><td>Move cursor to the beginning of the line</td></tr>
<tr><td><code>End</code>, <code>Ctrl</code>-<code>E</code></td><td>Move cursor to the end of the line</td></tr>
<tr><td><code>Ctrl</code>-<code>Left</code>, <code>Ctrl</code>-<code>Right</code></td><td>Move cursor one word left/right</td></tr>
<tr><td><code>Ctrl</code>-<code>K</code></td><td>Remove text to the right of the cursor</td></tr>
<tr><td><code>Ctrl</code>-<code>U</code></td><td>Remove text to the left of the cursor</td></tr>
</tbody></table>
<h2>Sharing calculations</h2>
<p>To share the result of a calculation with someone else, you can just copy the URL from
your browers address bar. As you enter new lines in the terminal, your input will be
appended to the URL to build up something like
<a href="https://numbat.dev/?q=let+P0+%3D+50_000+people%0Alet+growth_rate+%3D+2%25+per+year%0A%0Afn+population(t%3A+Time)+%3D%0A++++P0+%C3%97+e^(growth_rate%C2%B7t)+%2F%2F+round%0A%0Aprint(%22P(20+years)+%3D+%7Bpopulation(20+years)%7D%22)"><code>https://numbat.dev/?q=let+P0+%3D+50_000+people%0A…</code></a>
that you can just copy and share. To reset the state and clear the URL, use the <code>reset</code>
command (see above).</p>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Usage</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">The browser-based version of Numbat is available at &lt;https://numbat.dev/&gt;.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text"><a-p>##</a-p> <a-tt>Interactive terminal</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text">The terminal allows you to perform a sequence of calculations.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">You can use the arrow keys to browse through the command history.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">The special identifiers `ans` and `_` refer to the result of the last calculation. For example:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"><a-p>```</a-p><a-tl> numbat</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"><a-p>&gt;&gt;&gt; 60 kW h / 150 kW</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"><a-p>    = 0.4 h</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"><a-p>&gt;&gt;&gt; ans -&gt; minutes</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"><a-p>    = 24 min</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text"><a-p>## </a-p><a-tt>Commands</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>There is a set of special commands that only work in the web version:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"><a-p>| Command | Action |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>|---------|--------|</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>| `list`, `ll`, `ls` | List all constants, units, and dimensions |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>| `help`, `?` | View short help text |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"><a-p>| `reset` | Reset state (clear constants, functions, units, …) |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"><a-p>| `clear` | Clear screen |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"><a-p>## </a-p><a-tt>Key bindings</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"><a-p>In interactive command-line mode, you can use the following key bindings. Most importantly,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"><a-p>`Tab` for auto-completion, arrow keys and `Ctrl-R` for browsing the command history, and</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"><a-p>`Ctrl-D` for exiting the interactive session.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"><a-p>| Key sequence | Action |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"><a-p>|--------------|--------|</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>| `Tab` | Auto-completion |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"><a-p>| `Ctrl`-`L` | Clear screen |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>| `Up`, `Down` | Browse command history |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>| `Ctrl`-`R` | Search command history |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>| `Ctrl`-`C` | Clear the current line |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>| `Shift`-`Enter` | Insert newline |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"><a-p>| `Home`, `Ctrl`-`A` | Move cursor to the beginning of the line |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"><a-p>| `End`, `Ctrl`-`E` | Move cursor to the end of the line |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>| `Ctrl`-`Left`, `Ctrl`-`Right` | Move cursor one word left/right |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"><a-p>| `Ctrl`-`K` | Remove text to the right of the cursor |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"><a-p>| `Ctrl`-`U` | Remove text to the left of the cursor |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"><a-p>## </a-p><a-tt>Sharing calculations</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text">To share the result of a calculation with someone else, you can just copy the URL from</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text">your browers address bar. As you enter new lines in the terminal, your input will be</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L56" href="#L56">56</a><span class="code-text">appended to the URL to build up something like</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L57" href="#L57">57</a><span class="code-text">[`https://numbat.dev/?q=let+P0+%3D+50_000+people%0A…`](https://numbat.dev/?q=let+P0+%3D+50_000+people%0Alet+growth_rate+%3D+2%25+per+year%0A%0Afn+population(t%3A+Time)+%3D%0A++++P0+×+e^(growth_rate·t)+%2F%2F+round%0A%0Aprint(&quot;P(20+years)+%3D+{population(20+years)}&quot;))</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L58" href="#L58">58</a><span class="code-text">that you can just copy and share. To reset the state and clear the URL, use the `reset`</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L59" href="#L59">59</a><span class="code-text">command (see above).</span></span></pre></div></div>
</main>
</body>
</html>
