From 2fd3a7b32e554d021915ebbd3b6f00dd2b80ff16 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 1 Nov 2020 10:34:56 -0500 Subject: Recompile docs with new (more precise) dzaima/BQN number formatting --- docs/doc/block.html | 2 +- docs/doc/functional.html | 4 ++-- docs/doc/syntax.html | 2 +- docs/tutorial/expression.html | 16 ++++++++-------- docs/tutorial/list.html | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/doc/block.html b/docs/doc/block.html index 21354448..10896e93 100644 --- a/docs/doc/block.html +++ b/docs/doc/block.html @@ -94,7 +94,7 @@

However, Β· can only be used as an argument, and not a list element or operand. Don't use 𝕨 in these ways in a function that could be called monadically. Another potential issue is that ⊸ and ⟜ don't work the way you might expect.

↗️
    { 𝕨 β‹†βŠΈ- 𝕩 } 5
-143.413159102577
+143.4131591025766
 

Called dyadically, this function will expand to (⋆𝕨)-𝕩, so we might expect the monadic result to be -𝕩. This sort of expansion isn't right with Β· on the left. β‹†βŠΈ- taken as a whole is a function, so Β· β‹†βŠΈ- 𝕩 is just β‹†βŠΈ- 𝕩, or (⋆𝕩)-𝕩, giving the large result seen above.

Operands

diff --git a/docs/doc/functional.html b/docs/doc/functional.html index 7debbe20..76dc6777 100644 --- a/docs/doc/functional.html +++ b/docs/doc/functional.html @@ -111,11 +111,11 @@

Like any function, this one can be given a name and then called. A quirk of this way of defining a function is that it has a subject role (it's the result of the function {π•Žβˆ˜π•}Β΄) and so must be defined with a lowercase name.

↗️
    gauss ← {π•Žβˆ˜π•}Β΄ ⋆‿-β€Ώ(Γ—Λœ)
     Gauss 2
-0.0183156388887342
+0.01831563888873418
 

Another, and probably more common, use of arrays of functions is to apply several different functions to one or more arguments. Here we apply three different functions to the number 9:

↗️
    ⟨√, 2⊸∾, ⊒-β‹†βŸ© {π•Žπ•©}Β¨ 9
-⟨ 3 ⟨ 2 9 ⟩ ¯8094.08392757538 ⟩
+⟨ 3 ⟨ 2 9 ⟩ ¯8094.083927575384 ⟩
 

The 2-modifier Choose (β—Ά) relies on arrays of functions to… function. It's very closely related to Pick βŠ‘, and in fact when the left operand and the elements of the right operand are all data there's no real difference: Choose returns the constant function π•—βŠ‘π•˜.

↗️
    2β—Ά"abcdef" "arg"
diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html
index 4f8eb345..88e006fc 100644
--- a/docs/doc/syntax.html
+++ b/docs/doc/syntax.html
@@ -108,7 +108,7 @@
 

BQN has single-token notation for numbers, strings, and characters.

Numbers allow the typical decimal notation with Β― for the negative sign (because - is a function) and e for scientific notation (or E, as numeric notation is case-insensitive). ∞ and Ο€ may be used as special numeric values. If complex numbers are supported, then they can be written with the components separated by i. However, no BQN to date supports complex numbers.

↗️
    ⟨ Β―Ο€ β‹„ 0.5 β‹„ 5eΒ―1 β‹„ 1.5E3 β‹„ ∞ ⟩   # A list of numbers
-⟨ ¯3.14159265358979 0.5 0.5 1500 ∞ ⟩
+⟨ ¯3.141592653589793 0.5 0.5 1500 ∞ ⟩
 

Strings are written with double quotes "", and characters with single quotes '' with a single character in between. A double quote within a string can be escaped by writing it twice; if two string literals are next to each other, they must be separated by a space. In contrast, character literals do not use escapes, as the length is already known.

↗️
    β‰ Β¨ ⟨ "str" β‹„ "s't""r" β‹„ 'c' β‹„ ''' β‹„ '"' ⟩   # "" is an escape
diff --git a/docs/tutorial/expression.html b/docs/tutorial/expression.html
index d1a1d32a..07b8c4f0 100644
--- a/docs/tutorial/expression.html
+++ b/docs/tutorial/expression.html
@@ -33,7 +33,7 @@
 

Shown above are a few arithmetic operations. BQN manages to pass as a normal programming language for three lines so far. That's a big accomplishment for BQN! Earth's a confusing place!

The number of spaces between primitive functions like + and - and their arguments doesn't matter: you can use as much or as little as you like. No spaces inside numbers, of course.

↗️
    2 Γ— Ο€
-6.28318530717959
+6.283185307179586
     9 Γ· 2
 4.5
     ÷ ∞
@@ -71,9 +71,9 @@
     3 ⋆ 2
 9
     ⋆ 1   # There's no constant for e but you can get it this way
-2.71828182845905
+2.718281828459045
     ⋆ 2.3
-9.97418245481472
+9.974182454814718
 
@@ -92,7 +92,7 @@

You could use Power to take square roots and n-th roots, but BQN also provides the primitive √ for this purpose. If no left argument is provided, then it is the Square Root function; with a left argument it is called Root and raises the right argument to the power of one divided by the left argument.

↗️
    √ 2
-1.4142135623731
+1.4142135623730951
     3 √ 27
 3
 
@@ -112,7 +112,7 @@

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 just primitives but the ones you'll define as wellβ€”the same way. They are evaluated from right to left, and parentheses can be used to group subexpressions that have to be evaluated before being used as arguments.

For a longer example, here's an expression for the volume of a sphere with radius 2.

↗️
    (4Γ·3) Γ— Ο€ Γ— 2⋆3
-33.5103216382911
+33.510321638291124
 

The evaluation order is shown below, with the function ⋆ on the first line evaluated first, then Γ— on the next, and so on. The effect of the parentheses is that Γ· is evaluated before the leftmost Γ—.

@@ -159,9 +159,9 @@

One or two arguments?

What about functions without a left argument? Let's find an equation with lots of square roots in it… looks good.

↗️
    √ 3 + 2 Γ— √2
-2.4142135623731
+2.414213562373095
     1 + √2
-2.4142135623731
+2.414213562373095
 

They are the same, and now you can't say that BQN is the most complicated thing on this particular page! Just to make sure, we can find the difference by subtracting them, but we need to put the left argument in parentheses:

↗️
    (√3 + 2Γ—βˆš2) - 1+√2
@@ -317,7 +317,7 @@
 

The most important use for Undo in arithmetic is the logarithm, written ⋆⁼. That's all a logarithm is: it undoes the Power function! With no left argument ⋆⁼ is the natural logarithm. If there's a left argument then Undo considers it part of the function to be undone. The result in this case is that ⋆⁼ with two arguments is the logarithm of the right argument with base given by the left one.

↗️
    ⋆⁼ 10
-2.30258509299405
+2.302585092994046
     2 ⋆⁼ 32    # Log base 2
 5
     2 ⋆ 2 ⋆⁼ 32
diff --git a/docs/tutorial/list.html b/docs/tutorial/list.html
index 71ad8237..13760cbf 100644
--- a/docs/tutorial/list.html
+++ b/docs/tutorial/list.html
@@ -114,7 +114,7 @@
 

Arithmetic on lists

Arithmetic functions automatically apply to each element of a list argument. If both arguments are lists, they have to have the same length, and they're matched up one element at a time.

↗️
    ÷ ⟨2,3,4⟩
-⟨ 0.5 0.333333333333333 0.25 ⟩
+⟨ 0.5 0.3333333333333333 0.25 ⟩
 
     "APL" + 1
 "BQM"
-- 
cgit v1.2.3