From 9cfc45f731a121282f47218d6ab80c5b9b06e277 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 28 Jan 2022 20:56:46 -0500 Subject: Add ;:? to keybar and help --- docs/help/header.html | 25 +++++++++++++++++++++++++ docs/help/index.html | 12 ++++++++++++ docs/help/nextbody.html | 21 +++++++++++++++++++++ docs/help/predicate.html | 21 +++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 docs/help/header.html create mode 100644 docs/help/nextbody.html create mode 100644 docs/help/predicate.html (limited to 'docs/help') diff --git a/docs/help/header.html b/docs/help/header.html new file mode 100644 index 00000000..2dccabef --- /dev/null +++ b/docs/help/header.html @@ -0,0 +1,25 @@ + + + + BQN Colon (:) + + +

Colon (:)

+

:: Header

+

→full documentation

+

Placed at the end of a block header. A header has syntax that matches the way the block is called. It indicates the block type, and number and structure of inputs.

+↗️
    "xy" {ab _op c: b} 
+'y'
+
+

Multiple bodies are searched in order to find one with a matching header.

+↗️
    F  {m Fn n: m+Fn n;  𝕊n: 2×n;  𝕊𝕩: 𝕩÷2}
+
+    F 3      # 𝕊n
+6
+
+    F 6     # 𝕊⁼𝕩
+3
+
+    10 F 3   # m Fn n
+16
+
diff --git a/docs/help/index.html b/docs/help/index.html index 77f2dfa4..50372097 100644 --- a/docs/help/index.html +++ b/docs/help/index.html @@ -179,6 +179,10 @@ Group Indices, Group +: +Header + + Identity, Left @@ -239,6 +243,10 @@ Negate, Subtract +; +Next Body + + · Nothing @@ -263,6 +271,10 @@ Pi +? +Predicate + + Prefixes, Take diff --git a/docs/help/nextbody.html b/docs/help/nextbody.html new file mode 100644 index 00000000..f180ec55 --- /dev/null +++ b/docs/help/nextbody.html @@ -0,0 +1,21 @@ + + + + BQN: Semicolon (;) + + +

Semicolon (;)

+

;: Next Body

+

→full documentation

+

End the current block body and start a new one. Headers (:) and predicates (?) can control which body is evaluated. A function can have two headers without these, indicating the monadic and dyadic cases.

+↗️
    3 { 𝕩÷2 ; -𝕨𝕩 } 4   # Monadic and dyadic cases
+⟨ ¯3 ¯4 ⟩
+
+    F  {𝕊ab: a-b; 𝕊abc: b+c}
+
+    F 52                # Matches first header
+3
+
+    F 136              # Matches second header
+9
+
diff --git a/docs/help/predicate.html b/docs/help/predicate.html new file mode 100644 index 00000000..fdd89394 --- /dev/null +++ b/docs/help/predicate.html @@ -0,0 +1,21 @@ + + + + BQN: Question Mark (?) + + +

Question Mark (?)

+

?: Predicate

+

→full documentation

+

Follows a statement in a block, which must return 0 or 1. If it's 0, stop the current body and evaluate the next eligible one instead. Variables defined before the ? stay if execution continues (1) but don't carry over to other bodies (0).

+↗️
    {0 ? 3 ; 4}
+4
+
+    Min  {𝕨<𝕩 ? 𝕨 ; 𝕩}
+
+    3 Min 5
+3
+
+    4 Min 2
+2
+
-- cgit v1.2.3