3,038
edits
m (Bump year) |
m (→Modifiers: Disambiguate Atop (operator)) |
||
(26 intermediate revisions by 3 users not shown) | |||
Line 8: | Line 8: | ||
| released = 2020 | | released = 2020 | ||
| developer = [[Marshall Lochbaum]] | | developer = [[Marshall Lochbaum]] | ||
| latest release version = | | latest release version = 2022 (unversioned) | ||
| implementation languages = BQN | | implementation languages = BQN with [[wikipedia:JavaScript|JavaScript]], [[wikipedia:C (programming language)|C]], or others<ref name="running">[[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 = | | platforms = x86, ARM, in-browser, [[wikipedia:Node.js|Node.js]] | ||
| license = [[wikipedia:ISC license|ISC]] | | license = [[wikipedia:ISC license|ISC]] | ||
| website = [https://mlochbaum.github.io/BQN mlochbaum.github.io/BQN] | | website = [https://mlochbaum.github.io/BQN mlochbaum.github.io/BQN] | ||
| 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 = | | 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> | ||
| run online = [https:// | | influenced = | ||
| run online = [https://bqnpad.mechanize.systems/ BQNPAD] | |||
}} | }} | ||
'''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]]. | ||
== Implementations == | |||
BQN has several implementations,<ref name="running"/> with all complete ones based on self-hosted sources, which are compiled to bytecode and included as literal arrays or similar in the implementation's source. [https://github.com/dzaima/CBQN CBQN], developed by [[dzaima]] in [[wikipedia:C (programming language)|C]], is the primary implementation with the best performance. A [[wikipedia:JavaScript|JavaScript]] version can be run online. It's slower than CBQN compiled to [[wikipedia:WebAssembly|Wasm]], but easier to connect with browser functionality. | |||
The [https://github.com/mlochbaum/Singeli Singeli] language was developed in order to implement BQN more effectively. CBQN uses Singeli for primitive code that uses [[vector instruction]]s, and can be built with or without these optimized implementations. The Singeli implementation is written in BQN and currently targets C. | |||
=== dzaima/BQN === | |||
Now largely replaced by CBQN, dzaima/BQN is [[dzaima]]'s independent implementation in Java, based on [[dzaima/APL]]. While dzaima/APL adds significant new functionality and is different from any other APL, dzaima/BQN follows the BQN specification closely and sometimes extends it with [[system function]]s. It has often been the first implementation to support new functionality, particularly syntax such as block headers, and was the fastest implementation before CBQN was created. It introduced the [[wikipedia:bytecode|bytecode]] format now shared with self-hosted BQN, and was used for development and bootstrapping. | |||
== Primitives == | == Primitives == | ||
Line 52: | Line 63: | ||
| <code>¬</code> || [[Not]] || Span | | <code>¬</code> || [[Not]] || Span | ||
|- | |- | ||
| <code>|</code> || [[Absolute Value]] || [[Residue|Modulus]] | | <code><nowiki>|</nowiki></code> || [[Absolute Value]] || [[Residue|Modulus]] | ||
|- | |- | ||
| <code>≤</code> || || [[Less Than or Equal to]] | | <code>≤</code> || || [[Less Than or Equal to]] | ||
Line 100: | Line 111: | ||
| <code>⍒</code> || [[Grade|Grade Down]] || [[Interval_Index|Bins Down]] | | <code>⍒</code> || [[Grade|Grade Down]] || [[Interval_Index|Bins Down]] | ||
|- | |- | ||
| <code>⊏</code> || First Cell || Select | | <code>⊏</code> || First Cell || [[Select]] | ||
|- | |- | ||
| <code>⊑</code> || [[First]] || Pick | | <code>⊑</code> || [[First]] || Pick | ||
Line 146: | Line 157: | ||
! Glyph !! Name(s) | ! Glyph !! Name(s) | ||
|- | |- | ||
| <code>∘</code> || [[Atop]] | | <code>∘</code> || [[Atop (operator)|Atop]] | ||
|- | |- | ||
| <code>○</code> || [[Over]] | | <code>○</code> || [[Over]] | ||
|- | |- | ||
| <code>⊸</code> || [[Before]]/[[Bind]] | | <code>⊸</code> || [[Hook|Before]]/[[Bind]] | ||
|- | |- | ||
| <code>⟜</code> || [[After]]/[[Bind]] | | <code>⟜</code> || [[Hook|After]]/[[Bind]] | ||
|- | |- | ||
| <code>⌾</code> || [[Under]] | | <code>⌾</code> || [[Under]] | ||
Line 167: | Line 178: | ||
|} | |} | ||
|} | |} | ||
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>. | |||
== The Name BQN == | |||
The name "BQN" was originated as a forward iteration of the letters of APL, and "happens to match the capitals in 'Big Questions Notation'"<ref>[[Marshall Lochbaum]]. [https://mlochbaum.github.io/BQN/#what-kind-of-name-is-bqn "What Kind of a Name is BQN?"]</ref>. | |||
Lochbaum recounts, "I obtained 'BQN' by moving each letter in 'APL' forward by one in the alphabet. I'd come up with the backronym 'Big Questions Notation' by the time I realized N doesn't come after L."<ref>[[Marshall Lochbaum]]. [https://chat.stackexchange.com/transcript/message/54753804#54753804 Stack Exchange Transcript]</ref> | |||
Lochbaum commented further on this, saying: | |||
<blockquote> | |||
...the way I came up with the name BQN was I thought, ... alright, I'm working on this next APL. What do I call [it?] ... I took took APL and I moved it forward and I got BQN. And I said, well, BQN, that sounds pretty good... [B]ig Questions Notation is what I ended up with. I like it 'cause it suggests that not only you're solving big questions, but you have big questions about the notation, so it's a little tongue in cheek. And I said also, you can pronounce it like bacon, so there's even a food pun like Apple. And after some half hour or an hour of thinking about this, I realized that the letter that comes after L is M, not N. I think it would be much more logical for N to come first, because it's the letter with two humps. BQM is a horrible, horrible name, and so I stuck with BQN. | |||
<ref>[https://www.arraycast.com/episode-7-transcript Marshall Lochbaum and the BQN array language]. [[Array Cast]]. Aug 7, 2021. (In response to a question starting at the 11:29 mark.)</ref> | |||
</blockquote> | |||
== References == | |||
<references /> | |||
{{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category: | {{APL dialects}}[[Category:BQN| ]][[Category:Array languages]][[Category:Based array languages]][[Category:IR compilers]][[Category:Leading axis languages]][[Category:Languages with tacit programming]] |