documentation • specification • tutorials • implementation • community
Try it online below (arrow at the right for more samples and shift-enter to run), on this page, or in our chat. Use CBQN offline; details here.
"B Q N"
Looking for a modern, powerful language centered on Ken Iverson's array programming paradigm? BQN now provides:
BQN will provide:
I think BQN is a good choice for learning and enjoying array programming, scripting, prototyping, and number crunching at a single-CPU scale. For some examples of BQN in action, this repository holds the dreaded self-hosted compiler and the friendlier markdown processor used to generate the site. See also awesome BQN repositories, examples on RosettaCode, or something else from the community page.
It's three letters, that happen to match the capitals in "Big Questions Notation". You can pronounce it "bacon", but are advised to avoid this unless there's puns.
BQN aims to remove irregular and burdensome aspects of the APL tradition, and put the great ideas on a firmer footing. It maintains many of the ideas that made APL\360 revolutionary in 1966:
It incorporates concepts developed over years of APL practice:
But it's redesigned from the ground up, with many features new to the array paradigm:
Not sold? See why BQN? for an outline of what all these features add up to in terms of programming power.
Right at the beginning, you can use the bar above the online REPL to enter BQN code: hover over a character to see a short description, and click to insert it into the editor. But you'll soon want to skip the clicking and use keyboard input. I type the special characters using a backslash escape, so that, for example, typing
⥊ (the backslash character itself is not used by BQN). The online REPL supports this method out of the box, and the editor plugins include or link to ways to enable it for editors, browsers, shells, and so on.
The font comparison page shows several fonts that support BQN (including the one used on this site, BQN386). Most other monospace fonts are missing some BQN characters, such as double-struck letters
𝕩 and so on, which will cause these characters to be rendered with a fallback font and possibly have the wrong width or look inconsistent. The double-struck characters also require two bytes in UTF-16, which breaks rendering in some Windows terminals. Windows Terminal itself fixed this in 2023, and VS Code and wsl-terminal also support them with an appropriate font.
Chat forum links below; either of the bold ones will open in a browser without much hassle if you just want to get on quickly. Further forum details here.
Discord is a popular commercial chat client and Element is a similar UI for the open chat protocol Matrix. They're bridged together so that messages in one appear in the other. Most discussion happens on these (they're quite active), but see also the community page for activities and such in other places.
Also feel free to contact me personally via Github issues or with the email address shown in my Github profile.
If you're already an array programmer, you might start with the documentation right away, using the BQN-Dyalog APL or BQN-J dictionary as a quick reference where appropriate. Be aware of two key differences between BQN and existing array languages beyond just the changes of primitives—if these differences don't seem important to you then you don't understand them! BQN's based array model is different from both a flat array model like J and a nested one like APL2, Dyalog, or GNU APL in that it has true non-array values (plain numbers and characters) that are different from depth-0 scalars. BQN also uses syntactic roles rather than dynamic type to determine how values interact, that is, what's an argument or operand and so on. This system, along with lexical closures, means BQN fully supports Lisp-style functional programming.
A useful tool for both beginners and experienced users is BQNcrate, a searchable collection of BQN snippets to solve particular tasks. If you have a question about how you might approach a problem, give it a try by typing in a relevant keyword or two.