BQN: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Compilers category)
(fix syntax colouring)
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Infobox array language
{{Infobox array language
| logo                    = [[File:BQN logo.png]]
| array model              = [[based array model|based]]
| array model              = [[based array model|based]]
| index origin            = 0
| index origin            = 0
Line 29: Line 30:
! Glyph                    !! Monadic                  !! Dyadic
! Glyph                    !! Monadic                  !! Dyadic
|-
|-
| <source inline>+</source> || [[Conjugate]]            || [[Add]]
| <code>+</code> || [[Conjugate]]            || [[Add]]
|-
|-
| <source inline>-</source> || [[Negate]]                || [[Subtract]]
| <code>-</code> || [[Negate]]                || [[Subtract]]
|-
|-
| <source inline>×</source> || [[Sign]]                  || [[Multiply]]
| <code>×</code> || [[Sign]]                  || [[Multiply]]
|-
|-
| <source inline>÷</source> || [[Reciprocal]]            || [[Divide]]
| <code>÷</code> || [[Reciprocal]]            || [[Divide]]
|-
|-
| <source inline>⋆</source> || [[Exponential]]          || [[Power (function)|Power]]
| <code>⋆</code> || [[Exponential]]          || [[Power (function)|Power]]
|-
|-
| <source inline>√</source> || [[Square Root]]          || [[Root]]
| <code>√</code> || [[Square Root]]          || [[Root]]
|-
|-
| <source inline>⌊</source> || [[Floor]]                || [[Minimum]]
| <code>⌊</code> || [[Floor]]                || [[Minimum]]
|-
|-
| <source inline>⌈</source> || [[Ceiling]]              || [[Maximum]]
| <code>⌈</code> || [[Ceiling]]              || [[Maximum]]
|-
|-
| <source inline>∧</source> || Sort Up                  || [[And]]
| <code>∧</code> || Sort Up                  || [[And]]
|-
|-
| <source inline>∨</source> || Sort Down                || [[Or]]
| <code>∨</code> || Sort Down                || [[Or]]
|-
|-
| <source inline>¬</source> || [[Not]]                  || Span
| <code>¬</code> || [[Not]]                  || Span
|-
|-
| <source inline>|</source> || [[Absolute Value]]        || [[Residue|Modulus]]
| <code>|</code> || [[Absolute Value]]        || [[Residue|Modulus]]
|-
|-
| <source inline>≤</source> ||                          || [[Less Than or Equal to]]
| <code>≤</code> ||                          || [[Less Than or Equal to]]
|-
|-
| <source inline><</source> || [[Enclose]]              || [[Less Than]]
| <code><</code> || [[Enclose]]              || [[Less Than]]
|-
|-
| <source inline>></source> || [[Mix|Merge]]            || [[Greater Than]]
| <code>></code> || [[Mix|Merge]]            || [[Greater Than]]
|-
|-
| <source inline>≥</source> ||                          || [[Greater Than or Equal to]]
| <code>≥</code> ||                          || [[Greater Than or Equal to]]
|-
|-
| <source inline>=</source> || [[Rank]]                  || [[Equals]]
| <code>=</code> || [[Rank]]                  || [[Equals]]
|-
|-
| <source inline>≠</source> || [[Tally|Length]]          || [[Not Equals]]
| <code>≠</code> || [[Tally|Length]]          || [[Not Equals]]
|-
|-
| <source inline>≡</source> || [[Depth]]                || [[Match]]
| <code>≡</code> || [[Depth]]                || [[Match]]
|-
|-
| <source inline>≢</source> || [[Shape]]                || [[Not Match]]
| <code>≢</code> || [[Shape]]                || [[Not Match]]
|-
|-
| <source inline>⊣</source> || [[Identity]]              || [[Left]]
| <code>⊣</code> || [[Identity]]              || [[Left]]
|-
|-
| <source inline>⊢</source> || [[Identity]]              || [[Right]]
| <code>⊢</code> || [[Identity]]              || [[Right]]
|-
|-
| <source inline>⥊</source> || [[Ravel|Deshape]]        || [[Reshape]]
| <code>⥊</code> || [[Ravel|Deshape]]        || [[Reshape]]
|-
|-
| <source inline>∾</source> || [[Raze|Join]]            || [[Catenate|Join to]]
| <code>∾</code> || [[Raze|Join]]            || [[Catenate|Join to]]
|-
|-
| <source inline>≍</source> || Solo                      || Couple
| <code>≍</code> || Solo                      || Couple
|-
|-
| <source inline>↑</source> || Prefixes                  || [[Take]]
| <code>↑</code> || Prefixes                  || [[Take]]
|-
|-
| <source inline>↓</source> || Suffixes                  || [[Drop]]
| <code>↓</code> || Suffixes                  || [[Drop]]
|-
|-
| <source inline>↕</source> || [[Index Generator|Range]] || Windows
| <code>↕</code> || [[Index Generator|Range]] || Windows
|-
|-
| <source inline>»</source> || Nudge                    || Shift Before
| <code>»</code> || Nudge                    || Shift Before
|-
|-
| <source inline>«</source> || Nudge Back                || Shift After
| <code>«</code> || Nudge Back                || Shift After
|-
|-
| <source inline>⌽</source> || [[Reverse]]              || [[Rotate]]
| <code>⌽</code> || [[Reverse]]              || [[Rotate]]
|-
|-
| <source inline>⍉</source> || [[Transpose]]            || [[Transpose|Reorder axes]]
| <code>⍉</code> || [[Transpose]]            || [[Transpose|Reorder axes]]
|-
|-
| <source inline>/</source> || [[Indices]]              || [[Replicate]]
| <code>/</code> || [[Indices]]              || [[Replicate]]
|-
|-
| <source inline>⍋</source> || [[Grade|Grade Up]]        || [[Interval_Index|Bins Up]]
| <code>⍋</code> || [[Grade|Grade Up]]        || [[Interval_Index|Bins Up]]
|-
|-
| <source inline>⍒</source> || [[Grade|Grade Down]]      || [[Interval_Index|Bins Down]]
| <code>⍒</code> || [[Grade|Grade Down]]      || [[Interval_Index|Bins Down]]
|-
|-
| <source inline>⊏</source> || First Cell                || Select
| <code>⊏</code> || First Cell                || Select
|-
|-
| <source inline>⊑</source> || [[First]]                || Pick
| <code>⊑</code> || [[First]]                || Pick
|-
|-
| <source inline>⊐</source> || Classify                  || [[Index of]]
| <code>⊐</code> || Classify                  || [[Index of]]
|-
|-
| <source inline>⊒</source> || [[Occurrence Count]]      || [[Progressive Index of]]
| <code>⊒</code> || [[Occurrence Count]]      || [[Progressive Index of]]
|-
|-
| <source inline>∊</source> || [[Unique Mask]]          || [[Member of]]
| <code>∊</code> || [[Unique Mask]]          || [[Member of]]
|-
|-
| <source inline>⍷</source> || [[Unique|Deduplicate]]    || [[Find]]
| <code>⍷</code> || [[Unique|Deduplicate]]    || [[Find]]
|-
|-
| <source inline>⊔</source> || Group Indices            || Group
| <code>⊔</code> || Group Indices            || Group
|}
|}


=== Modifiers ===
=== Modifiers ===


[[Monadic operator|1-modifiers]] in BQN use superscript symbols, while [[Dyadic operator|2-modifiers]] use symbols with a circle, but not one with a line through it like <source inline>⌽</source> and <source inline>⍉</source>.
[[Monadic operator|1-modifiers]] in BQN use superscript symbols, while [[Dyadic operator|2-modifiers]] use symbols with a circle, but not one with a line through it like <code>⌽</code> and <code>⍉</code>.


{|
{|
Line 123: Line 124:
! Glyph                    !! Name(s)
! Glyph                    !! Name(s)
|-
|-
| <source inline>˙</source> || [[Constant]]
| <code>˙</code> || [[Constant]]
|-
|-
| <source inline>˜</source> || [[Commute|Self/Swap]]
| <code>˜</code> || [[Commute|Self/Swap]]
|-
|-
| <source inline>˘</source> || Cells
| <code>˘</code> || Cells
|-
|-
| <source inline>¨</source> || [[Each]]
| <code>¨</code> || [[Each]]
|-
|-
| <source inline>⌜</source> || [[Outer Product|Table]]
| <code>⌜</code> || [[Outer Product|Table]]
|-
|-
| <source inline>⁼</source> || Undo
| <code>⁼</code> || Undo
|-
|-
| <source inline>´</source> || [[Reduce|Fold]]
| <code>´</code> || [[Reduce|Fold]]
|-
|-
| <source inline>˝</source> || [[Reduce|Insert]]
| <code>˝</code> || [[Reduce|Insert]]
|-
|-
| <source inline>`</source> || [[Scan]]
| <code>`</code> || [[Scan]]
|}
|}
|style="vertical-align:top"|
|style="vertical-align:top"|
Line 145: Line 146:
! Glyph                    !! Name(s)
! Glyph                    !! Name(s)
|-
|-
| <source inline>∘</source> || [[Atop]]
| <code>∘</code> || [[Atop]]
|-
|-
| <source inline>○</source> || [[Over]]
| <code>○</code> || [[Over]]
|-
|-
| <source inline>⊸</source> || [[Before]]/[[Bind]]
| <code>⊸</code> || [[Before]]/[[Bind]]
|-
|-
| <source inline>⟜</source> || [[After]]/[[Bind]]
| <code>⟜</code> || [[After]]/[[Bind]]
|-
|-
| <source inline>⌾</source> || [[Under]]
| <code>⌾</code> || [[Under]]
|-
|-
| <source inline>⊘</source> || Valences
| <code>⊘</code> || Valences
|-
|-
| <source inline>◶</source> || Choose
| <code>◶</code> || Choose
|-
|-
| <source inline>⎉</source> || [[Rank (operator)|Rank]]
| <code>⎉</code> || [[Rank (operator)|Rank]]
|-
|-
| <source inline>⚇</source> || [[Depth (operator)|Depth]]
| <code>⚇</code> || [[Depth (operator)|Depth]]
|-
|-
| <source inline>⍟</source> || [[Power (operator)|Repeat]]
| <code>⍟</code> || [[Power (operator)|Repeat]]
|}
|}
|}
|}


{{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category:Compilers]][[Category:Leading axis languages]][[Category:Languages with tacit programming]]
{{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category:Compilers]][[Category:Leading axis languages]][[Category:Languages with tacit programming]]

Revision as of 21:07, 28 December 2020


BQN is an APL-family language designed primarily by Marshall Lochbaum. Although it maintains the concept of array-driven computing and much of APL's array functionality, BQN discards all compatibility with other array languages and changes many fundamental concepts. It uses the based array model with dedicated array notation, distinguishes between data types and expression roles to give the language a context-free grammar with first-class functions, and uses a new set of glyphs with different primitive pairings. The language uses the leading axis model and tacit programming as core paradigms. Its implementation is largely self-hosted, with an array-based compiler like Co-dfns.

Primitives

Functions

Glyph Monadic Dyadic
+ Conjugate Add
- Negate Subtract
× Sign Multiply
÷ Reciprocal Divide
Exponential Power
Square Root Root
Floor Minimum
Ceiling Maximum
Sort Up And
Sort Down Or
¬ Not Span
Absolute Value Modulus
Less Than or Equal to
< Enclose Less Than
> Merge Greater Than
Greater Than or Equal to
= Rank Equals
Length Not Equals
Depth Match
Shape Not Match
Identity Left
Identity Right
Deshape Reshape
Join Join to
Solo Couple
Prefixes Take
Suffixes Drop
Range Windows
» Nudge Shift Before
« Nudge Back Shift After
Reverse Rotate
Transpose Reorder axes
/ Indices Replicate
Grade Up Bins Up
Grade Down Bins Down
First Cell Select
First Pick
Classify Index of
Occurrence Count Progressive Index of
Unique Mask Member of
Deduplicate Find
Group Indices Group

Modifiers

1-modifiers in BQN use superscript symbols, while 2-modifiers use symbols with a circle, but not one with a line through it like and .

Glyph Name(s)
˙ Constant
˜ Self/Swap
˘ Cells
¨ Each
Table
Undo
´ Fold
˝ Insert
` Scan
Glyph Name(s)
Atop
Over
Before/Bind
After/Bind
Under
Valences
Choose
Rank
Depth
Repeat


APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000Pometo
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages