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 +++++++++++++++++++++ docs/repl.js | 4 ++-- 5 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 docs/help/header.html create mode 100644 docs/help/nextbody.html create mode 100644 docs/help/predicate.html (limited to 'docs') 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
+
diff --git a/docs/repl.js b/docs/repl.js index bac0ca98..7eb55471 100644 --- a/docs/repl.js +++ b/docs/repl.js @@ -115,8 +115,8 @@ let typeChar = (t, c, ev) => { return false; } -let syncls={ v:"Value", f:"Function", m:"Modifier", d:"Modifier2", n:"Number", g:"Gets", p:"Paren", b:"Bracket", k:"Brace", l:"Ligature", n:"Nothing", s:"Separator", c:"Comment", a:"String" }; -let keydesc='f+Conjugate;Add_f-Negate;Subtract_f×Sign;Multiply_f÷Reciprocal;Divide_f⋆Exponential;Power_f√Square Root;Root_f⌊Floor;Minimum_f⌈Ceiling;Maximum_f∧Sort Up;And_f∨Sort Down;Or_f¬Not;Span_f|Absolute Value;Modulus_f≤Less Than or Equal to_fMerge;Greater Than_f≥Greater Than or Equal to_f=Rank;Equals_f≠Length;Not Equals_f≡Depth;Match_f≢Shape;Not Match_f⊣Identity;Left_f⊢Identity;Right_f⥊Deshape;Reshape_f∾Join;Join to_f≍Solo;Couple_f⋈Enlist;Pair_f↑Prefixes;Take_f↓Suffixes;Drop_f↕Range;Windows_f«Shift Before_f»Shift After_f⌽Reverse;Rotate_f⍉Transpose;Reorder axes_f/Indices;Replicate_f⍋Grade Up;Bins Up_f⍒Grade Down;Bins Down_f⊏First Cell;Select_f⊑First;Pick_f⊐Classify;Index of_f⊒Occurrence Count;Progressive Index of_f∊Mark First;Member of_f⍷Deduplicate;Find_f⊔Group Indices;Group_f!Assert;Assert with message_m˙Constant_m˜Self/Swap_d∘Atop_d○Over_d⊸Before/Bind_d⟜After/Bind_d⌾Under_d⊘Valences_d◶Choose_d⎊Catch_d⎉Rank_m˘Cells_d⚇Depth_m¨Each_m⌜Table_d⍟Repeat_m⁼Undo_m´Fold_m˝Insert_m`Scan_g←Define_g⇐Export_g↩Change_s⋄Separator_s,Separator_v.Namespace field_p(Begin expression_p)End expression_k{Begin block_k}End block_b⟨Begin list_b⟩End list_l‿Strand_n·Nothing_v•System_v𝕨Left argument_f𝕎Left argument (as function)_v𝕩Right argument_f𝕏Right argument (as function)_v𝕗Modifier left operand (as subject)_f𝔽Modifier left operand_v𝕘2-modifier right operand (as subject)_f𝔾2-modifier right operand_v𝕤Current function (as subject)_f𝕊Current function_m𝕣Current modifier_n¯Minus_nπPi_n∞Infinity_a@Null character_c#Comment'.split(/[\n_]/); +let syncls={ v:"Value", f:"Function", m:"Modifier", d:"Modifier2", n:"Number", g:"Gets", p:"Paren", b:"Bracket", k:"Brace", h:"Head", l:"Ligature", n:"Nothing", s:"Separator", c:"Comment", a:"String" }; +let keydesc='f+Conjugate;Add_f-Negate;Subtract_f×Sign;Multiply_f÷Reciprocal;Divide_f⋆Exponential;Power_f√Square Root;Root_f⌊Floor;Minimum_f⌈Ceiling;Maximum_f∧Sort Up;And_f∨Sort Down;Or_f¬Not;Span_f|Absolute Value;Modulus_f≤Less Than or Equal to_fMerge;Greater Than_f≥Greater Than or Equal to_f=Rank;Equals_f≠Length;Not Equals_f≡Depth;Match_f≢Shape;Not Match_f⊣Identity;Left_f⊢Identity;Right_f⥊Deshape;Reshape_f∾Join;Join to_f≍Solo;Couple_f⋈Enlist;Pair_f↑Prefixes;Take_f↓Suffixes;Drop_f↕Range;Windows_f«Shift Before_f»Shift After_f⌽Reverse;Rotate_f⍉Transpose;Reorder axes_f/Indices;Replicate_f⍋Grade Up;Bins Up_f⍒Grade Down;Bins Down_f⊏First Cell;Select_f⊑First;Pick_f⊐Classify;Index of_f⊒Occurrence Count;Progressive Index of_f∊Mark First;Member of_f⍷Deduplicate;Find_f⊔Group Indices;Group_f!Assert;Assert with message_m˙Constant_m˜Self/Swap_d∘Atop_d○Over_d⊸Before/Bind_d⟜After/Bind_d⌾Under_d⊘Valences_d◶Choose_d⎊Catch_d⎉Rank_m˘Cells_d⚇Depth_m¨Each_m⌜Table_d⍟Repeat_m⁼Undo_m´Fold_m˝Insert_m`Scan_g←Define_g⇐Export_g↩Change_s⋄Separator_s,Separator_v.Namespace field_p(Begin expression_p)End expression_k{Begin block_k}End block_h;Next body_h:Header_h?Predicate_b⟨Begin list_b⟩End list_l‿Strand_n·Nothing_v•System_v𝕨Left argument_f𝕎Left argument (as function)_v𝕩Right argument_f𝕏Right argument (as function)_v𝕗Modifier left operand (as subject)_f𝔽Modifier left operand_v𝕘2-modifier right operand (as subject)_f𝔾2-modifier right operand_v𝕤Current function (as subject)_f𝕊Current function_m𝕣Current modifier_n¯Minus_nπPi_n∞Infinity_a@Null character_c#Comment'.split(/[\n_]/); let kk=Array.from('`123456890-=~!@#$%^&*()_+qwertuiop[]QWERTIOP{}asdfghjkl;ASFGHKL:"zxcvbm,./ZXVBM<>? \''); let kv=Array.from('˜˘¨⁼⌜´˝∞¯•÷׬⎉⚇⍟◶⊘⎊⍎⍕⟨⟩√⋆⌽𝕨∊↑∧⊔⊏⊐π←→↙𝕎⍷𝕣⍋⊑⊒⍳⊣⊢⍉𝕤↕𝕗𝕘⊸∘○⟜⋄↖𝕊𝔽𝔾«⌾»·˙⥊𝕩↓∨⌊≡∾≍≠⋈𝕏⍒⌈≢≤≥⇐‿↩'); let keys={}, revkeys={}, primhelp={}, helpurl={}; -- cgit v1.2.3