BQN: Difference between revisions
(Infobox and introduction) |
|||
(12 intermediate revisions by 2 users 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 7: | Line 8: | ||
| released = 2020 | | released = 2020 | ||
| developer = [[Marshall Lochbaum]] | | developer = [[Marshall Lochbaum]] | ||
| latest release version = | | latest release version = 2021 (unversioned) | ||
| implementation languages = BQN | | implementation languages = BQN with [[wikipedia:JavaScript|JavaScript]], [[wikipedia:C (programming language)|C]], or others<ref>[[Marshall Lochbaum]]. [https://mlochbaum.github.io/BQN/running.html "How to run BQN"]</ref> | ||
| source = [https://github.com/mlochbaum/BQN GitHub] | | source = [https://github.com/mlochbaum/BQN GitHub] | ||
| platforms = In-browser, [[wikipedia:Node.js|Node.js]] | | platforms = In-browser, [[wikipedia:Node.js|Node.js]] | ||
Line 15: | Line 16: | ||
| file ext = .bqn | | file ext = .bqn | ||
| documentation = [https://mlochbaum.github.io/BQN/doc Documentation] | | documentation = [https://mlochbaum.github.io/BQN/doc Documentation] | ||
| influenced by = [[J]], [[A+]], [[Dyalog APL]], [[Co-dfns]], [[APL\iv]], [[wikipedia:JavaScript|JavaScript]] | | forum = [https://app.element.io/#/room/%23bqn:matrix.org #bqn:matrix.org] | ||
| influenced by = [[J]], [[A+]], [[Dyalog APL]], [[Co-dfns]], [[APL\iv]], [[wikipedia:JavaScript|JavaScript]]<ref>[[Marshall Lochbaum]]. [https://mlochbaum.github.io/BQN/commentary/history.html "BQN's development history"].</ref> | |||
| influenced = [[dzaima/BQN]] | | influenced = [[dzaima/BQN]] | ||
| run online = [https://mlochbaum.github.io/BQN/try.html Online REPL] | | run online = [https://mlochbaum.github.io/BQN/try.html Online REPL] | ||
Line 22: | Line 24: | ||
'''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 [[backwards compatibility|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 [[wikipedia:context-free grammar|context-free grammar]] with [[wikipedia:first-class function|first-class function]]s, and uses a new set of [[glyph]]s 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]]. | '''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 [[backwards compatibility|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 [[wikipedia:context-free grammar|context-free grammar]] with [[wikipedia:first-class function|first-class function]]s, and uses a new set of [[glyph]]s 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]]. | ||
{{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]] | == Primitives == | ||
=== Functions === | |||
{|class=wikitable | |||
! Glyph !! Monadic !! Dyadic | |||
|- | |||
| <code>+</code> || [[Conjugate]] || [[Add]] | |||
|- | |||
| <code>-</code> || [[Negate]] || [[Subtract]] | |||
|- | |||
| <code>×</code> || [[Sign]] || [[Multiply]] | |||
|- | |||
| <code>÷</code> || [[Reciprocal]] || [[Divide]] | |||
|- | |||
| <code>⋆</code> || [[Exponential]] || [[Power (function)|Power]] | |||
|- | |||
| <code>√</code> || [[Square Root]] || [[Root]] | |||
|- | |||
| <code>⌊</code> || [[Floor]] || [[Minimum]] | |||
|- | |||
| <code>⌈</code> || [[Ceiling]] || [[Maximum]] | |||
|- | |||
| <code>∧</code> || Sort Up || [[And]] | |||
|- | |||
| <code>∨</code> || Sort Down || [[Or]] | |||
|- | |||
| <code>¬</code> || [[Not]] || Span | |||
|- | |||
| <code><nowiki>|</nowiki></code> || [[Absolute Value]] || [[Residue|Modulus]] | |||
|- | |||
| <code>≤</code> || || [[Less Than or Equal to]] | |||
|- | |||
| <code><</code> || [[Enclose]] || [[Less Than]] | |||
|- | |||
| <code>></code> || [[Mix|Merge]] || [[Greater Than]] | |||
|- | |||
| <code>≥</code> || || [[Greater Than or Equal to]] | |||
|- | |||
| <code>=</code> || [[Rank]] || [[Equals]] | |||
|- | |||
| <code>≠</code> || [[Tally|Length]] || [[Not Equals]] | |||
|- | |||
| <code>≡</code> || [[Depth]] || [[Match]] | |||
|- | |||
| <code>≢</code> || [[Shape]] || [[Not Match]] | |||
|- | |||
| <code>⊣</code> || [[Identity]] || [[Left]] | |||
|- | |||
| <code>⊢</code> || [[Identity]] || [[Right]] | |||
|- | |||
| <code>⥊</code> || [[Ravel|Deshape]] || [[Reshape]] | |||
|- | |||
| <code>∾</code> || [[Raze|Join]] || [[Catenate|Join to]] | |||
|- | |||
| <code>≍</code> || Solo || Couple | |||
|- | |||
| <code>↑</code> || Prefixes || [[Take]] | |||
|- | |||
| <code>↓</code> || Suffixes || [[Drop]] | |||
|- | |||
| <code>↕</code> || [[Index Generator|Range]] || Windows | |||
|- | |||
| <code>»</code> || Nudge || Shift Before | |||
|- | |||
| <code>«</code> || Nudge Back || Shift After | |||
|- | |||
| <code>⌽</code> || [[Reverse]] || [[Rotate]] | |||
|- | |||
| <code>⍉</code> || [[Transpose]] || [[Transpose|Reorder axes]] | |||
|- | |||
| <code>/</code> || [[Indices]] || [[Replicate]] | |||
|- | |||
| <code>⍋</code> || [[Grade|Grade Up]] || [[Interval_Index|Bins Up]] | |||
|- | |||
| <code>⍒</code> || [[Grade|Grade Down]] || [[Interval_Index|Bins Down]] | |||
|- | |||
| <code>⊏</code> || First Cell || [[Select]] | |||
|- | |||
| <code>⊑</code> || [[First]] || Pick | |||
|- | |||
| <code>⊐</code> || Classify || [[Index of]] | |||
|- | |||
| <code>⊒</code> || [[Occurrence Count]] || [[Progressive Index of]] | |||
|- | |||
| <code>∊</code> || [[Unique Mask]] || [[Member of]] | |||
|- | |||
| <code>⍷</code> || [[Unique|Deduplicate]] || [[Find]] | |||
|- | |||
| <code>⊔</code> || Group Indices || Group | |||
|} | |||
=== 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 <code>⌽</code> and <code>⍉</code>. | |||
{| | |||
|style="vertical-align:top"| | |||
{|class=wikitable | |||
! Glyph !! Name(s) | |||
|- | |||
| <code>˙</code> || [[Constant]] | |||
|- | |||
| <code>˜</code> || [[Commute|Self/Swap]] | |||
|- | |||
| <code>˘</code> || Cells | |||
|- | |||
| <code>¨</code> || [[Each]] | |||
|- | |||
| <code>⌜</code> || [[Outer Product|Table]] | |||
|- | |||
| <code>⁼</code> || Undo | |||
|- | |||
| <code>´</code> || [[Reduce|Fold]] | |||
|- | |||
| <code>˝</code> || [[Reduce|Insert]] | |||
|- | |||
| <code>`</code> || [[Scan]] | |||
|} | |||
|style="vertical-align:top"| | |||
{|class=wikitable | |||
! Glyph !! Name(s) | |||
|- | |||
| <code>∘</code> || [[Atop]] | |||
|- | |||
| <code>○</code> || [[Over]] | |||
|- | |||
| <code>⊸</code> || [[Hook|Before]]/[[Bind]] | |||
|- | |||
| <code>⟜</code> || [[Hook|After]]/[[Bind]] | |||
|- | |||
| <code>⌾</code> || [[Under]] | |||
|- | |||
| <code>⊘</code> || Valences | |||
|- | |||
| <code>◶</code> || Choose | |||
|- | |||
| <code>⎉</code> || [[Rank (operator)|Rank]] | |||
|- | |||
| <code>⚇</code> || [[Depth (operator)|Depth]] | |||
|- | |||
| <code>⍟</code> || [[Power (operator)|Repeat]] | |||
|} | |||
|} | |||
Some modifiers are closely related, and some of their glyphs are intended to allude to this: | |||
* The three 1-modifers Cells (<code>𝔽˘</code>), Each (<code>𝔽¨</code>), and Undo (<code>𝔽⁼</code>) are equivalent to using a right-[[operand]] of <code>¯1</code> with the 2-modifiers Rank (<code>𝔽⎉¯1</code>), Depth (<code>𝔽⚇¯1</code>), and Repeat (<code>𝔽⍟¯1</code>). Therefore the 2-modifiers are circled versions of the 1-modifiers (except in the case of Undo/Repeat). | |||
* Under (<code>𝔽⌾𝔾</code>) is in principle equivalent to <code>𝔾⁼∘𝔽○𝔾</code>. Therefore, <code>⌾</code> is a combination of the glyphs <code>∘</code> and <code>○</code>. | |||
== References == | |||
<references /> | |||
{{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category:Bytecode compilers]][[Category:Leading axis languages]][[Category:Languages with tacit programming]] |
Revision as of 18:35, 30 May 2021
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 ⍉
.
|
|
Some modifiers are closely related, and some of their glyphs are intended to allude to this:
- The three 1-modifers Cells (
𝔽˘
), Each (𝔽¨
), and Undo (𝔽⁼
) are equivalent to using a right-operand of¯1
with the 2-modifiers Rank (𝔽⎉¯1
), Depth (𝔽⚇¯1
), and Repeat (𝔽⍟¯1
). Therefore the 2-modifiers are circled versions of the 1-modifiers (except in the case of Undo/Repeat). - Under (
𝔽⌾𝔾
) is in principle equivalent to𝔾⁼∘𝔽○𝔾
. Therefore,⌾
is a combination of the glyphs∘
and○
.
References
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |