From 4739618a7f14a224274c40e43471a7fd0bba6c9f Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 19 Aug 2020 22:52:18 -0400 Subject: Separate pages on primitive functions and types from README --- docs/doc/primitive.html | 336 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 336 insertions(+) create mode 100644 docs/doc/primitive.html (limited to 'docs/doc/primitive.html') diff --git a/docs/doc/primitive.html b/docs/doc/primitive.html new file mode 100644 index 00000000..a245632e --- /dev/null +++ b/docs/doc/primitive.html @@ -0,0 +1,336 @@ + + +

BQN primitives

+

Primitives are functions and modifiers that are built into the language.

+

Functions

+

Functions that have significant differences from APL functions are marked with an asterisk. Links for these entries go to dedicated BQN documentation while other links go to the APL Wiki.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GlyphMonadicDyadic
+ConjugateAdd
-NegateSubtract
×SignMultiply
÷ReciprocalDivide
ExponentialPower
Square RootRoot
FloorMinimum
CeilingMaximum
Sort UpAnd*
Sort DownOr*
¬Not*Span*
|Absolute ValueModulus
Less Than or Equal to
<EncloseLess Than
>Merge*Greater Than
Greater Than or Equal to
=RankEquals
LengthNot Equals
Depth*Match
ShapeNot Match
IdentityLeft
IdentityRight
DeshapeReshape
Join*Join to
Solo*Couple*
Prefixes*Take
Suffixes*Drop
RangeWindows*
ReverseRotate
Transpose*Reorder axes*
/IndicesReplicate
Grade UpBins Up
Grade DownBins Down
First Cell*Select*
FirstPick*
Index of
Occurrence Count*Progressive Index of*
Unique MaskMember of
DeduplicateFind
Group Indices*Group*
+

Modifiers

+

Combinators only control the application of functions. Because a non-function operand applies as a constant function, some combinators have extra meanings when passed a constant. For example, 0˜ is the constant function that always returns 0 and 0< is the function that tests whether its right argument is greater than 0.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GlyphName(s)DefinitionDescription
˜Self/Swap{𝕩𝔽𝕨𝕩}Duplicate one argument or exchange two
Atop{𝔽𝕨𝔾𝕩}Apply 𝔾 to both arguments and 𝔽 to the result
Over{(𝔾𝕨)𝔽𝔾𝕩}Apply 𝔾 to each argument and 𝔽 to the results
Before/Bind{(𝔽𝕨𝕩)𝔾𝕩}𝔾's left argument comes from 𝔽
After/Bind{(𝕨𝕩)𝔽𝔾𝕩}𝔽's right argument comes from 𝔾
Under{𝔾𝔽𝔾} OR {(𝔾𝕩)𝕨𝔽𝔾𝕩𝕩}Apply 𝔽 over 𝔾, then undo 𝔾
Valences{𝔽𝕩;𝕨𝔾𝕩}Apply 𝔽 if there's one argument but 𝔾 if there are two
Choose{f(𝕨𝔽𝕩)𝕘 𝕨F𝕩}Select one of the functions in list 𝕘 based on 𝔽
+

Choose isn't really a combinator since it calls the function , and Under is not a true combinator since it has an "undo" step at the end. This step might be implemented using the left operand's inverse (computational Under) or its structural properties (structural Under).

+

Other modifiers control array traversal and iteration. In three cases a simpler 1-modifier is paired with a generalized 2-modifier: in each case the 1-modifier happens to be the same as the 2-modifier with a right operand of ¯1.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1-ModifierName2-ModifierName
˘CellsRank
¨EachDepth
Table
UndoRepeat
´Fold
˝Insert
`Scan
+ -- cgit v1.2.3