aboutsummaryrefslogtreecommitdiff
path: root/docs/tutorial/expression.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-12-30 20:57:20 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-12-30 20:57:20 -0500
commit8ddad454b30cdafc9bbdc0cbd51c653bee8a87e5 (patch)
tree9c267498157b26caf82ff5e0baf9b190a5e84837 /docs/tutorial/expression.html
parent2f4f1d38f0aec449c39a15cdaaa5e160b4a78a4e (diff)
Rebuild with CBQN's new number formatting (ryu)
Diffstat (limited to 'docs/tutorial/expression.html')
-rw-r--r--docs/tutorial/expression.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/tutorial/expression.html b/docs/tutorial/expression.html
index 6c654cd7..52de145d 100644
--- a/docs/tutorial/expression.html
+++ b/docs/tutorial/expression.html
@@ -97,7 +97,7 @@
<p>You could use Power to take square roots and <em>n</em>-th roots, but BQN has a primitive <code><span class='Function'>√</span></code> for this purpose. If no left argument is provided, then it's the Square Root function; with a left argument it's called Root, and raises the right argument to the power of one divided by the left argument.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oiaIDIKMyDiiJogMjc=">↗️</a><pre> <span class='Function'>√</span> <span class='Number'>2</span>
-1.414213562373095
+1.4142135623730951
<span class='Number'>3</span> <span class='Function'>√</span> <span class='Number'>27</span>
3
</pre>
@@ -117,7 +117,7 @@
<p>I bet if you try hard you'll remember how much you hated learning to do exponentiation before multiplication and division before addition and subtraction. Didn't I tell you Earth was a confusing place? BQN treats all functions—not only primitives, but also the ones you define—the same way. They're evaluated from right to left, and parentheses form subexpressions that are evaluated entirely before they can be used.</p>
<p>For a longer example, here's an expression for the <a href="https://en.wikipedia.org/wiki/Sphere#Enclosed_volume">volume of a sphere</a> with radius 2.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KDTDtzMpIMOXIM+AIMOXIDLii4Yz">↗️</a><pre> <span class='Paren'>(</span><span class='Number'>4</span><span class='Function'>÷</span><span class='Number'>3</span><span class='Paren'>)</span> <span class='Function'>×</span> <span class='Number'>π</span> <span class='Function'>×</span> <span class='Number'>2</span><span class='Function'>⋆</span><span class='Number'>3</span>
-33.51032163829112
+33.510321638291124
</pre>
<p>The evaluation order is diagrammed below, with the function <code><span class='Function'>⋆</span></code> at the highest level evaluated first, then <code><span class='Function'>×</span></code> below it, and so on. The effect of the parentheses is that <code><span class='Function'>÷</span></code> is evaluated before the leftmost <code><span class='Function'>×</span></code>.</p>
<svg viewBox='-174.7 -34 512 188'>