diff options
| -rw-r--r-- | README.md | 72 | ||||
| -rw-r--r-- | commentary/why.md | 11 | ||||
| -rw-r--r-- | community/README.md | 12 | ||||
| -rw-r--r-- | docs/commentary/why.html | 11 | ||||
| -rw-r--r-- | docs/community/index.html | 6 | ||||
| -rw-r--r-- | docs/index.html | 56 |
6 files changed, 99 insertions, 69 deletions
@@ -8,7 +8,7 @@ </center> -*Try it online below (shift-enter to run), on [this page](https://mlochbaum.github.io/BQN/try.html), or [in our chat](#where-can-i-find-bqn-users). Use [CBQN](https://github.com/dzaima/CBQN) offline; details [here](running.md).* +*Try it online below (arrow at the right for more samples and shift-enter to run), on [this page](https://mlochbaum.github.io/BQN/try.html), or [in our chat](#where-can-i-find-bqn-users). Use [CBQN](https://github.com/dzaima/CBQN) offline; details [here](running.md).* <!--GEN E ← ⊐⟜":"⊸(↑At"class="∾1⊸+⊸↓)⊸Enc repl ← "div:cont" E ⟨ @@ -22,9 +22,29 @@ repl ← "div:cont" E ⟨ repl ∾< ∾(""Enc˜"script"Attr"src"≍○<∾⟜".js")¨"bqn"‿"repl" --> -**BQN** is a new programming language in the APL lineage, which aims to remove irregular and burdensome aspects of the APL tradition and put the great ideas on a firmer footing. While its use demands a solid understanding of functions and multidimensional arrays, BQN's focus on providing simple, consistent, and powerful array operations (and documentation!) makes it a good language for learning array programming and building stronger array intuition. +Want to learn and use a modern, powerful language centered on Ken Iverson's array programming paradigm? BQN **now provides**: -BQN maintains many of the ideas that made APL\360 revolutionary in 1966: +- A simple, consistent, and [stable](commentary/stability.md) array programming language +- Documentation with examples, visuals, explanations, and rationale for features +- Basic [system functions](spec/system.md) for common math, file, and IO operations +- A low-dependency C implementation using bytecode compilation + +BQN **will provide**: + +- State of the art array performance: takes some time, but I developed many of Dyalog APL's current algorithms and know we'll get there +- Interfaces to connect with other languages, like a C FFI and JSON and CSV tools +- A standard system to install and use libraries and packages, and support for package managers +- Replace or extend primitives to make a BQN-like language suited for specialized domains + +At present, I think BQN is a good choice for learning array programming, scripting, small- to medium-scale number crunching, and recreational programming. + +## What kind of name is "BQN"? + +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. + +## What's the language like? + +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: * Human-friendly [**infix notation**](tutorial/expression.md) has no precedence rules to remember. * [**Built-in array operations**](doc/primitive.md) handle any number of dimensions easily. * [**Higher-order functions**](doc/primitive.md#modifiers) allow basic functions to be applied in more powerful ways. @@ -34,23 +54,15 @@ It incorporates concepts developed over years of APL practice: * [Trains](doc/train.md) and combinators enable **tacit programming**. * Lightweight [**anonymous functions**](doc/block.md) (like [dfns](https://aplwiki.com/wiki/Dfn)) borrow some power from Lisp. -But BQN is redesigned from the ground up, with brand new ideas to make these paradigms easier to use and less likely to fail. +But it's redesigned from the ground up, with many features new to the array paradigm: * The [**based array model**](doc/based.md) eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated [**list notation**](doc/arrayrepr.md#list-literals) does away with the [gotchas](doc/arrayrepr.md#why-not-whitespace) of [stranding](https://aplwiki.com/wiki/Strand_notation). * [**Context-free grammar**](doc/context.md) makes it easier for machines and humans to understand code, and naturally leads to [**first-class functions**](doc/functional.md), which can even be used to [reinvent control structures](doc/control.md). * [**New symbols**](keymap.md) for built-in functionality make the syntactic role of every primitive instantly visible, and aim to be more consistent and intuitive. * No-nonsense [**namespace syntax**](doc/namespace.md) encapsulates data and even allows for a little [object-oriented programming](doc/oop.md). -## What kind of name is "BQN"? - -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. - -## What does BQN look like? - -Rather strange, most likely: +To see what a BQN program might look like, you can [gaze into the abyss](src/c.bqn) that is the self-hosted compiler, or try the friendlier [markdown processor](md.bqn) used to build this website. Or the collection of scripts at [bqn-libs](https://github.com/mlochbaum/bqn-libs). - ⊑+`∘⌽⍟12↕2 # The 12th Fibonacci number - -More snippets are programmed into the live demo at the top of the page: hit the arrow at the right of the code window to see them. For longer samples, you can [gaze into the abyss](src/c.bqn) that is the self-hosted compiler, or the [shallower but wider abyss](src/r1.bqn) of the runtime, or take a look at the friendlier [markdown processor](md.bqn) used to format and highlight documentation files. This repository also has [some translations](examples/fifty.bqn) from ["A History of APL in 50 Functions"](https://www.jsoftware.com/papers/50/). +Not sold? See [why BQN?](commentary/why.md) for an outline of what all these features add up to in terms of programming power. ## How do I work with the character set? @@ -58,26 +70,6 @@ Right at the beginning, you can use the bar above the online REPL to enter BQN c The [font comparison page](https://mlochbaum.github.io/BQN/fonts.html) 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 many Windows terminals. If you have this problem, VS Code and [wsl-terminal](https://github.com/mskyaxl/wsl-terminal) with an appropriate font definitely support them. -## Why would I use it? - -There are plenty of clean, modern languages out there, and a good number of array languages. I don't think any other language fits both descriptions quite so well as BQN, and I find the combination lets me write powerful and reliable programs quickly. What you find in the language will depend on your background. - -If you haven't yet used an array language, BQN will present you with new ways of thinking that can streamline the way you work with data and algorithms. There's no denying that array programming has begun to creep into the mainstream, and you might be wondering if BQN has anything to offer when you can hack reduces and filters with the best of them. It does: real array programming is different in character, with more and better array operations on immutable multidimensional arrays, and syntax better suited to them. Performance that resembles a low-level compiled language more than a high-level dynamic one. Primitives flow together and compose better—one aspect that sets BQN apart from other array languages is a set of combinators that's more intuitive than previous attempts. I also happen to think BQN's [character arithmetic](tutorial/expression.md#character-arithmetic) system would improve just about any language. - -If your favorite language is J, you are missing out even more! Array programmers never seem willing to accept that good ideas can come from people other than Iverson and that legends like John McCarthy and Barbara Liskov advanced human knowledge of how to express computation. They did, and being able to casually pass around first-class functions and mutable closures, with namespaces keeping everything organized, is a huge quality of life improvement. Writing APL again is claustrophobic, the syntax worries and constraints in functionality suddenly rushing back. BQN's mutable objects make methods such as graph algorithms that just don't have a good array implementation (no, your O(n³) matrix method doesn't scale) possible, even natural. With bytecode compilation and NaN-boxing, a natural fit for the based array model, it evaluates that scalar code many times faster than APL or J. The Unix-oriented scripting system stretches seamlessly from quick sketch to multi-file program. - -BQN has no intention of being the last word in programming, but could be a practical and elegant tool in your kit—even if only used to inform your use of another language. Give it a try! - -## How do I get started? - -*The documentation still has some pages missing (not many now), while the tutorials are probably less than half complete. I don't think this is much of an impediment any more. Ask about anything you find confusing on the forums.* - -BQN's [**tutorials**](tutorial/README.md) are intended as an introduction to array programming with BQN. They assume only knowledge of elementary mathematics, but will probably be hard to follow if you have *no* programming experience. BQN has a lot in common with dynamically-typed functional languages like Lisp, Julia, or Javascript, so knowledge of these languages will be particularly helpful. The tutorials end abruptly right now, so you'll have to switch to the documentation, which is less structured. - -If you're already an array programmer, you might start with the [**documentation**](doc/README.md) right away, using the [BQN-Dyalog APL](doc/fromDyalog.md) or [BQN-J](doc/fromJ.md) 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](doc/primitive.md)—if these differences don't seem important to you then you don't understand them! BQN's [based array model](doc/based.md) 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](doc/context.md) 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](doc/functional.md). - -A useful tool for both beginners and experienced users is [**BQNcrate**](https://mlochbaum.github.io/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. - ## Where can I find BQN users? 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](community/forums.md). @@ -91,14 +83,12 @@ Chat forum links below; either of the bold ones will open in a browser without m Also feel free to contact me personally via Github issues or with the email address shown in my Github profile. -## Can I help out? - -Certainly! There are never enough hours in the day and contributors from beginner to advanced programmers are all welcome. If you're interested I recommend you ask on the forums first to get a feel for what exactly is needed. +## How do I get started? -You will certainly feel an urge to skip this paragraph and get to the fun stuff, but the most important resource for implementing a language is **testing** and the most valuable one for building a language community is accessible introductions to the language and **learning materials**. These are both very demanding, but if you're willing to put in the work to advance BQN in the most effective way then this is it. One form of documentation that many users would appreciate is short descriptions—a sentence or two with examples—of the primitives for each glyph that can be displayed as help in the REPL. To be honest I'm lousy at making these and would prefer for someone else to do it. +*The documentation still has some pages missing (not many now), while the tutorials are probably less than half complete. I don't think this is much of an impediment any more. Ask about anything you find confusing on the forums.* -Work on BQN's **implementation** generally requires a high level of programming skill. We are focusing development effort on [CBQN](https://github.com/dzaima/CBQN) (see this [source overview](https://github.com/dzaima/CBQN/blob/master/src/README.md)). It's true that the entire compiler and a (decreasing) portion of the runtime is written in BQN, but it would be hard to do much with these as they are very nearly complete, and work satisfactorily. On the other hand, there is a lot that needs to be written in C, including [system values](spec/system.md) and higher-performance [primitives](implementation/primitive/README.md). And there's no need to work on *our* implementation! BQN's [specification](spec/README.md) and [tests](test/README.txt) are there to make sure you can write a conforming implementation, and extend it with your own ideas. It's also possible to take advantage of the self-hosted BQN sources by writing a [virtual machine](implementation/vm.md) that allows you to embed BQN in the language of your choice. +BQN's [**tutorials**](tutorial/README.md) are intended as an introduction to array programming with BQN. They assume only knowledge of elementary mathematics, but will probably be hard to follow if you have *no* programming experience. BQN has a lot in common with dynamically-typed functional languages like Lisp, Julia, or Javascript, so knowledge of these languages will be particularly helpful. The tutorials end abruptly right now, so you'll have to switch to the documentation, which is less structured. -Building **libraries** for BQN users can make writing programs in the language much more approachable. You are a better judge of which libraries are needed than I. Port some code from another language, implement some useful functionality in a field you specialize in, or try something new that interests you. A library should be structured as a file (which might load other files) that loads a namespace. This isn't too well-documented now, but see the [namespace documentation](doc/namespace.md) for hints. +If you're already an array programmer, you might start with the [**documentation**](doc/README.md) right away, using the [BQN-Dyalog APL](doc/fromDyalog.md) or [BQN-J](doc/fromJ.md) 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](doc/primitive.md)—if these differences don't seem important to you then you don't understand them! BQN's [based array model](doc/based.md) 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](doc/context.md) 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](doc/functional.md). -Those are possibilities, not limitations. The best way to contribute might be fixing something I never knew was wrong. +A useful tool for both beginners and experienced users is [**BQNcrate**](https://mlochbaum.github.io/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. diff --git a/commentary/why.md b/commentary/why.md new file mode 100644 index 00000000..a8ded255 --- /dev/null +++ b/commentary/why.md @@ -0,0 +1,11 @@ +*View this file with results and syntax highlighting [here](https://mlochbaum.github.io/BQN/commentary/why.html).* + +# Why use BQN? + +There are plenty of clean, modern languages out there, and a good number of array languages. I don't think any other language fits both descriptions quite so well as BQN, and I find the combination lets me write powerful and reliable programs quickly. What you find in the language will depend on your background. + +If you haven't yet used an array language, BQN will present you with new ways of thinking that can streamline the way you work with data and algorithms. There's no denying that array programming has begun to creep into the mainstream, and you might be wondering if BQN has anything to offer when you can hack reduces and filters with the best of them. It does: real array programming is different in character, with more and better array operations on immutable multidimensional arrays, and syntax better suited to them. Performance that resembles a low-level compiled language more than a high-level dynamic one. Primitives flow together and compose better—one aspect that sets BQN apart from other array languages is a set of combinators that's more intuitive than previous attempts. I also happen to think BQN's [character arithmetic](tutorial/expression.md#character-arithmetic) system would improve just about any language. + +If your favorite language is J, you are missing out even more! Array programmers never seem willing to accept that good ideas can come from people other than Iverson and that legends like John McCarthy and Barbara Liskov advanced human knowledge of how to express computation. They did, and being able to casually pass around first-class functions and mutable closures, with namespaces keeping everything organized, is a huge quality of life improvement. Writing APL again is claustrophobic, the syntax worries and constraints in functionality suddenly rushing back. BQN's mutable objects make methods such as graph algorithms that just don't have a good array implementation (no, your O(n³) matrix method doesn't scale) possible, even natural. With bytecode compilation and NaN-boxing, a natural fit for the based array model, it evaluates that scalar code many times faster than APL or J. The Unix-oriented scripting system stretches seamlessly from quick sketch to multi-file program. + +BQN has no intention of being the last word in programming, but could be a practical and elegant tool in your kit—even if only used to inform your use of another language. Give it a try! diff --git a/community/README.md b/community/README.md index b400c739..ede4b220 100644 --- a/community/README.md +++ b/community/README.md @@ -18,3 +18,15 @@ And the links below point to BQN submissions on some sites that encourage shorte And also: - [BQN fan art](fanart.md) + +## Can I help out? + +Certainly! There are never enough hours in the day and contributors from beginner to advanced programmers are all welcome. If you're interested I recommend you ask on the forums first to get a feel for what exactly is needed. + +You will certainly feel an urge to skip this paragraph and get to the fun stuff, but the most important resource for implementing a language is **testing** and the most valuable one for building a language community is accessible introductions to the language and **learning materials**. These are both very demanding, but if you're willing to put in the work to advance BQN in the most effective way then this is it. One form of documentation that many users would appreciate is short descriptions—a sentence or two with examples—of the primitives for each glyph that can be displayed as help in the REPL. To be honest I'm lousy at making these and would prefer for someone else to do it. + +Work on BQN's **implementation** generally requires a high level of programming skill. We are focusing development effort on [CBQN](https://github.com/dzaima/CBQN) (see this [source overview](https://github.com/dzaima/CBQN/blob/master/src/README.md)). It's true that the entire compiler and a (decreasing) portion of the runtime is written in BQN, but it would be hard to do much with these as they are very nearly complete, and work satisfactorily. On the other hand, there is a lot that needs to be written in C, including [system values](spec/system.md) and higher-performance [primitives](implementation/primitive/README.md). And there's no need to work on *our* implementation! BQN's [specification](spec/README.md) and [tests](test/README.txt) are there to make sure you can write a conforming implementation, and extend it with your own ideas. It's also possible to take advantage of the self-hosted BQN sources by writing a [virtual machine](implementation/vm.md) that allows you to embed BQN in the language of your choice. + +Building **libraries** for BQN users can make writing programs in the language much more approachable. You are a better judge of which libraries are needed than I. Port some code from another language, implement some useful functionality in a field you specialize in, or try something new that interests you. A library should be structured as a file (which might load other files) that loads a namespace. This isn't too well-documented now, but see the [namespace documentation](doc/namespace.md) for hints. + +Those are possibilities, not limitations. The best way to contribute might be fixing something I never knew was wrong. diff --git a/docs/commentary/why.html b/docs/commentary/why.html new file mode 100644 index 00000000..ccf237ba --- /dev/null +++ b/docs/commentary/why.html @@ -0,0 +1,11 @@ +<head> + <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/> + <link href="../style.css" rel="stylesheet"/> + <title>Why use BQN?</title> +</head> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">commentary</a></div> +<h1 id="why-use-bqn"><a class="header" href="#why-use-bqn">Why use BQN?</a></h1> +<p>There are plenty of clean, modern languages out there, and a good number of array languages. I don't think any other language fits both descriptions quite so well as BQN, and I find the combination lets me write powerful and reliable programs quickly. What you find in the language will depend on your background.</p> +<p>If you haven't yet used an array language, BQN will present you with new ways of thinking that can streamline the way you work with data and algorithms. There's no denying that array programming has begun to creep into the mainstream, and you might be wondering if BQN has anything to offer when you can hack reduces and filters with the best of them. It does: real array programming is different in character, with more and better array operations on immutable multidimensional arrays, and syntax better suited to them. Performance that resembles a low-level compiled language more than a high-level dynamic one. Primitives flow together and compose better—one aspect that sets BQN apart from other array languages is a set of combinators that's more intuitive than previous attempts. I also happen to think BQN's <a href="tutorial/expression.html#character-arithmetic">character arithmetic</a> system would improve just about any language.</p> +<p>If your favorite language is J, you are missing out even more! Array programmers never seem willing to accept that good ideas can come from people other than Iverson and that legends like John McCarthy and Barbara Liskov advanced human knowledge of how to express computation. They did, and being able to casually pass around first-class functions and mutable closures, with namespaces keeping everything organized, is a huge quality of life improvement. Writing APL again is claustrophobic, the syntax worries and constraints in functionality suddenly rushing back. BQN's mutable objects make methods such as graph algorithms that just don't have a good array implementation (no, your O(n³) matrix method doesn't scale) possible, even natural. With bytecode compilation and NaN-boxing, a natural fit for the based array model, it evaluates that scalar code many times faster than APL or J. The Unix-oriented scripting system stretches seamlessly from quick sketch to multi-file program.</p> +<p>BQN has no intention of being the last word in programming, but could be a practical and elegant tool in your kit—even if only used to inform your use of another language. Give it a try!</p> diff --git a/docs/community/index.html b/docs/community/index.html index e9e9b987..0211f295 100644 --- a/docs/community/index.html +++ b/docs/community/index.html @@ -21,3 +21,9 @@ <ul> <li><a href="fanart.html">BQN fan art</a></li> </ul> +<h2 id="can-i-help-out"><a class="header" href="#can-i-help-out">Can I help out?</a></h2> +<p>Certainly! There are never enough hours in the day and contributors from beginner to advanced programmers are all welcome. If you're interested I recommend you ask on the forums first to get a feel for what exactly is needed.</p> +<p>You will certainly feel an urge to skip this paragraph and get to the fun stuff, but the most important resource for implementing a language is <strong>testing</strong> and the most valuable one for building a language community is accessible introductions to the language and <strong>learning materials</strong>. These are both very demanding, but if you're willing to put in the work to advance BQN in the most effective way then this is it. One form of documentation that many users would appreciate is short descriptions—a sentence or two with examples—of the primitives for each glyph that can be displayed as help in the REPL. To be honest I'm lousy at making these and would prefer for someone else to do it.</p> +<p>Work on BQN's <strong>implementation</strong> generally requires a high level of programming skill. We are focusing development effort on <a href="https://github.com/dzaima/CBQN">CBQN</a> (see this <a href="https://github.com/dzaima/CBQN/blob/master/src/README.md">source overview</a>). It's true that the entire compiler and a (decreasing) portion of the runtime is written in BQN, but it would be hard to do much with these as they are very nearly complete, and work satisfactorily. On the other hand, there is a lot that needs to be written in C, including <a href="spec/system.html">system values</a> and higher-performance <a href="implementation/primitive/index.html">primitives</a>. And there's no need to work on <em>our</em> implementation! BQN's <a href="spec/index.html">specification</a> and <a href="https://github.com/mlochbaum/BQN/blob/master/community/test/README.txt">tests</a> are there to make sure you can write a conforming implementation, and extend it with your own ideas. It's also possible to take advantage of the self-hosted BQN sources by writing a <a href="implementation/vm.html">virtual machine</a> that allows you to embed BQN in the language of your choice.</p> +<p>Building <strong>libraries</strong> for BQN users can make writing programs in the language much more approachable. You are a better judge of which libraries are needed than I. Port some code from another language, implement some useful functionality in a field you specialize in, or try something new that interests you. A library should be structured as a file (which might load other files) that loads a namespace. This isn't too well-documented now, but see the <a href="doc/namespace.html">namespace documentation</a> for hints.</p> +<p>Those are possibilities, not limitations. The best way to contribute might be fixing something I never knew was wrong.</p> diff --git a/docs/index.html b/docs/index.html index 458d4aa4..92067722 100644 --- a/docs/index.html +++ b/docs/index.html @@ -10,7 +10,7 @@ <p><a href="doc/index.html">documentation</a> • <a href="spec/index.html">specification</a> • <a href="tutorial/index.html">tutorials</a> • <a href="implementation/index.html">implementation</a> • <a href="community/index.html">community</a></p> </center> -<p><em>Try it online below (shift-enter to run), on <a href="https://mlochbaum.github.io/BQN/try.html">this page</a>, or <a href="#where-can-i-find-bqn-users">in our chat</a>. Use <a href="https://github.com/dzaima/CBQN">CBQN</a> offline; details <a href="running.html">here</a>.</em></p> +<p><em>Try it online below (arrow at the right for more samples and shift-enter to run), on <a href="https://mlochbaum.github.io/BQN/try.html">this page</a>, or <a href="#where-can-i-find-bqn-users">in our chat</a>. Use <a href="https://github.com/dzaima/CBQN">CBQN</a> offline; details <a href="running.html">here</a>.</em></p> <div class='cont'> <div class='kb'></div> <div class='rel'> @@ -21,8 +21,25 @@ </div> <script src='bqn.js'></script><script src='repl.js'></script> -<p><strong>BQN</strong> is a new programming language in the APL lineage, which aims to remove irregular and burdensome aspects of the APL tradition and put the great ideas on a firmer footing. While its use demands a solid understanding of functions and multidimensional arrays, BQN's focus on providing simple, consistent, and powerful array operations (and documentation!) makes it a good language for learning array programming and building stronger array intuition.</p> -<p>BQN maintains many of the ideas that made APL\360 revolutionary in 1966:</p> +<p>Want to learn and use a modern, powerful language centered on Ken Iverson's array programming paradigm? BQN <strong>now provides</strong>:</p> +<ul> +<li>A simple, consistent, and <a href="commentary/stability.html">stable</a> array programming language</li> +<li>Documentation with examples, visuals, explanations, and rationale for features</li> +<li>Basic <a href="spec/system.html">system functions</a> for common math, file, and IO operations</li> +<li>A low-dependency C implementation using bytecode compilation</li> +</ul> +<p>BQN <strong>will provide</strong>:</p> +<ul> +<li>State of the art array performance: takes some time, but I developed many of Dyalog APL's current algorithms and know we'll get there</li> +<li>Interfaces to connect with other languages, like a C FFI and JSON and CSV tools</li> +<li>A standard system to install and use libraries and packages, and support for package managers</li> +<li>Replace or extend primitives to make a BQN-like language suited for specialized domains</li> +</ul> +<p>At present, I think BQN is a good choice for learning array programming, scripting, small- to medium-scale number crunching, and recreational programming.</p> +<h2 id="what-kind-of-name-is-bqn"><a class="header" href="#what-kind-of-name-is-bqn">What kind of name is "BQN"?</a></h2> +<p>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.</p> +<h2 id="whats-the-language-like"><a class="header" href="#whats-the-language-like">What's the language like?</a></h2> +<p>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:</p> <ul> <li>Human-friendly <a href="tutorial/expression.html"><strong>infix notation</strong></a> has no precedence rules to remember.</li> <li><a href="doc/primitive.html"><strong>Built-in array operations</strong></a> handle any number of dimensions easily.</li> @@ -34,34 +51,18 @@ <li><a href="doc/train.html">Trains</a> and combinators enable <strong>tacit programming</strong>.</li> <li>Lightweight <a href="doc/block.html"><strong>anonymous functions</strong></a> (like <a href="https://aplwiki.com/wiki/Dfn">dfns</a>) borrow some power from Lisp.</li> </ul> -<p>But BQN is redesigned from the ground up, with brand new ideas to make these paradigms easier to use and less likely to fail.</p> +<p>But it's redesigned from the ground up, with many features new to the array paradigm:</p> <ul> <li>The <a href="doc/based.html"><strong>based array model</strong></a> eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated <a href="doc/arrayrepr.html#list-literals"><strong>list notation</strong></a> does away with the <a href="doc/arrayrepr.html#why-not-whitespace">gotchas</a> of <a href="https://aplwiki.com/wiki/Strand_notation">stranding</a>.</li> <li><a href="doc/context.html"><strong>Context-free grammar</strong></a> makes it easier for machines and humans to understand code, and naturally leads to <a href="doc/functional.html"><strong>first-class functions</strong></a>, which can even be used to <a href="doc/control.html">reinvent control structures</a>.</li> <li><a href="keymap.html"><strong>New symbols</strong></a> for built-in functionality make the syntactic role of every primitive instantly visible, and aim to be more consistent and intuitive.</li> <li>No-nonsense <a href="doc/namespace.html"><strong>namespace syntax</strong></a> encapsulates data and even allows for a little <a href="doc/oop.html">object-oriented programming</a>.</li> </ul> -<h2 id="what-kind-of-name-is-bqn"><a class="header" href="#what-kind-of-name-is-bqn">What kind of name is "BQN"?</a></h2> -<p>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.</p> -<h2 id="what-does-bqn-look-like"><a class="header" href="#what-does-bqn-look-like">What does BQN look like?</a></h2> -<p>Rather strange, most likely:</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqRK2DiiJjijL3ijZ8xMuKGlTIgICMgVGhlIDEydGggRmlib25hY2NpIG51bWJlcg==">↗️</a><pre> <span class='Function'>⊑+</span><span class='Modifier'>`</span><span class='Modifier2'>∘</span><span class='Function'>⌽</span><span class='Modifier2'>⍟</span><span class='Number'>12</span><span class='Function'>↕</span><span class='Number'>2</span> <span class='Comment'># The 12th Fibonacci number -</span>144 -</pre> -<p>More snippets are programmed into the live demo at the top of the page: hit the arrow at the right of the code window to see them. For longer samples, you can <a href="https://github.com/mlochbaum/BQN/blob/master/src/c.bqn">gaze into the abyss</a> that is the self-hosted compiler, or the <a href="https://github.com/mlochbaum/BQN/blob/master/src/r1.bqn">shallower but wider abyss</a> of the runtime, or take a look at the friendlier <a href="https://github.com/mlochbaum/BQN/blob/master/md.bqn">markdown processor</a> used to format and highlight documentation files. This repository also has <a href="https://github.com/mlochbaum/BQN/blob/master/examples/fifty.bqn">some translations</a> from <a href="https://www.jsoftware.com/papers/50/">"A History of APL in 50 Functions"</a>.</p> +<p>To see what a BQN program might look like, you can <a href="https://github.com/mlochbaum/BQN/blob/master/src/c.bqn">gaze into the abyss</a> that is the self-hosted compiler, or try the friendlier <a href="https://github.com/mlochbaum/BQN/blob/master/md.bqn">markdown processor</a> used to build this website. Or the collection of scripts at <a href="https://github.com/mlochbaum/bqn-libs">bqn-libs</a>.</p> +<p>Not sold? See <a href="commentary/why.html">why BQN?</a> for an outline of what all these features add up to in terms of programming power.</p> <h2 id="how-do-i-work-with-the-character-set"><a class="header" href="#how-do-i-work-with-the-character-set">How do I work with the character set?</a></h2> <p>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 <code><span class='Value'>\</span></code> then <code><span class='Value'>z</span></code> writes <code><span class='Function'>⥊</span></code> (the backslash character itself is not used by BQN). The online REPL supports this method out of the box, and the <a href="editors/index.html">editor plugins</a> include or link to ways to enable it for editors, browsers, shells, and so on.</p> <p>The <a href="https://mlochbaum.github.io/BQN/fonts.html">font comparison page</a> 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 <code><span class='Value'>𝕨</span></code>, <code><span class='Value'>𝕩</span></code> 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 many Windows terminals. If you have this problem, VS Code and <a href="https://github.com/mskyaxl/wsl-terminal">wsl-terminal</a> with an appropriate font definitely support them.</p> -<h2 id="why-would-i-use-it"><a class="header" href="#why-would-i-use-it">Why would I use it?</a></h2> -<p>There are plenty of clean, modern languages out there, and a good number of array languages. I don't think any other language fits both descriptions quite so well as BQN, and I find the combination lets me write powerful and reliable programs quickly. What you find in the language will depend on your background.</p> -<p>If you haven't yet used an array language, BQN will present you with new ways of thinking that can streamline the way you work with data and algorithms. There's no denying that array programming has begun to creep into the mainstream, and you might be wondering if BQN has anything to offer when you can hack reduces and filters with the best of them. It does: real array programming is different in character, with more and better array operations on immutable multidimensional arrays, and syntax better suited to them. Performance that resembles a low-level compiled language more than a high-level dynamic one. Primitives flow together and compose better—one aspect that sets BQN apart from other array languages is a set of combinators that's more intuitive than previous attempts. I also happen to think BQN's <a href="tutorial/expression.html#character-arithmetic">character arithmetic</a> system would improve just about any language.</p> -<p>If your favorite language is J, you are missing out even more! Array programmers never seem willing to accept that good ideas can come from people other than Iverson and that legends like John McCarthy and Barbara Liskov advanced human knowledge of how to express computation. They did, and being able to casually pass around first-class functions and mutable closures, with namespaces keeping everything organized, is a huge quality of life improvement. Writing APL again is claustrophobic, the syntax worries and constraints in functionality suddenly rushing back. BQN's mutable objects make methods such as graph algorithms that just don't have a good array implementation (no, your O(n³) matrix method doesn't scale) possible, even natural. With bytecode compilation and NaN-boxing, a natural fit for the based array model, it evaluates that scalar code many times faster than APL or J. The Unix-oriented scripting system stretches seamlessly from quick sketch to multi-file program.</p> -<p>BQN has no intention of being the last word in programming, but could be a practical and elegant tool in your kit—even if only used to inform your use of another language. Give it a try!</p> -<h2 id="how-do-i-get-started"><a class="header" href="#how-do-i-get-started">How do I get started?</a></h2> -<p><em>The documentation still has some pages missing (not many now), while the tutorials are probably less than half complete. I don't think this is much of an impediment any more. Ask about anything you find confusing on the forums.</em></p> -<p>BQN's <a href="tutorial/index.html"><strong>tutorials</strong></a> are intended as an introduction to array programming with BQN. They assume only knowledge of elementary mathematics, but will probably be hard to follow if you have <em>no</em> programming experience. BQN has a lot in common with dynamically-typed functional languages like Lisp, Julia, or Javascript, so knowledge of these languages will be particularly helpful. The tutorials end abruptly right now, so you'll have to switch to the documentation, which is less structured.</p> -<p>If you're already an array programmer, you might start with the <a href="doc/index.html"><strong>documentation</strong></a> right away, using the <a href="doc/fromDyalog.html">BQN-Dyalog APL</a> or <a href="doc/fromJ.html">BQN-J</a> dictionary as a quick reference where appropriate. Be aware of two key differences between BQN and existing array languages beyond just the changes of <a href="doc/primitive.html">primitives</a>—if these differences don't seem important to you then you don't understand them! BQN's <a href="doc/based.html">based array model</a> 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 <a href="doc/context.html">syntactic roles</a> 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 <a href="doc/functional.html">functional programming</a>.</p> -<p>A useful tool for both beginners and experienced users is <a href="https://mlochbaum.github.io/bqncrate/"><strong>BQNcrate</strong></a>, 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.</p> <h2 id="where-can-i-find-bqn-users"><a class="header" href="#where-can-i-find-bqn-users">Where can I find BQN users?</a></h2> <p>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 <a href="community/forums.html">here</a>.</p> <table> @@ -90,9 +91,8 @@ </table> <p><a href="https://en.wikipedia.org/wiki/Discord_(software)">Discord</a> is a popular commercial chat client and Element is a similar UI for the open chat protocol <a href="https://matrix.org/">Matrix</a>. 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 <a href="community/index.html">community</a> page for activities and such in other places.</p> <p>Also feel free to contact me personally via Github issues or with the email address shown in my Github profile.</p> -<h2 id="can-i-help-out"><a class="header" href="#can-i-help-out">Can I help out?</a></h2> -<p>Certainly! There are never enough hours in the day and contributors from beginner to advanced programmers are all welcome. If you're interested I recommend you ask on the forums first to get a feel for what exactly is needed.</p> -<p>You will certainly feel an urge to skip this paragraph and get to the fun stuff, but the most important resource for implementing a language is <strong>testing</strong> and the most valuable one for building a language community is accessible introductions to the language and <strong>learning materials</strong>. These are both very demanding, but if you're willing to put in the work to advance BQN in the most effective way then this is it. One form of documentation that many users would appreciate is short descriptions—a sentence or two with examples—of the primitives for each glyph that can be displayed as help in the REPL. To be honest I'm lousy at making these and would prefer for someone else to do it.</p> -<p>Work on BQN's <strong>implementation</strong> generally requires a high level of programming skill. We are focusing development effort on <a href="https://github.com/dzaima/CBQN">CBQN</a> (see this <a href="https://github.com/dzaima/CBQN/blob/master/src/README.md">source overview</a>). It's true that the entire compiler and a (decreasing) portion of the runtime is written in BQN, but it would be hard to do much with these as they are very nearly complete, and work satisfactorily. On the other hand, there is a lot that needs to be written in C, including <a href="spec/system.html">system values</a> and higher-performance <a href="implementation/primitive/index.html">primitives</a>. And there's no need to work on <em>our</em> implementation! BQN's <a href="spec/index.html">specification</a> and <a href="https://github.com/mlochbaum/BQN/blob/master/test/README.txt">tests</a> are there to make sure you can write a conforming implementation, and extend it with your own ideas. It's also possible to take advantage of the self-hosted BQN sources by writing a <a href="implementation/vm.html">virtual machine</a> that allows you to embed BQN in the language of your choice.</p> -<p>Building <strong>libraries</strong> for BQN users can make writing programs in the language much more approachable. You are a better judge of which libraries are needed than I. Port some code from another language, implement some useful functionality in a field you specialize in, or try something new that interests you. A library should be structured as a file (which might load other files) that loads a namespace. This isn't too well-documented now, but see the <a href="doc/namespace.html">namespace documentation</a> for hints.</p> -<p>Those are possibilities, not limitations. The best way to contribute might be fixing something I never knew was wrong.</p> +<h2 id="how-do-i-get-started"><a class="header" href="#how-do-i-get-started">How do I get started?</a></h2> +<p><em>The documentation still has some pages missing (not many now), while the tutorials are probably less than half complete. I don't think this is much of an impediment any more. Ask about anything you find confusing on the forums.</em></p> +<p>BQN's <a href="tutorial/index.html"><strong>tutorials</strong></a> are intended as an introduction to array programming with BQN. They assume only knowledge of elementary mathematics, but will probably be hard to follow if you have <em>no</em> programming experience. BQN has a lot in common with dynamically-typed functional languages like Lisp, Julia, or Javascript, so knowledge of these languages will be particularly helpful. The tutorials end abruptly right now, so you'll have to switch to the documentation, which is less structured.</p> +<p>If you're already an array programmer, you might start with the <a href="doc/index.html"><strong>documentation</strong></a> right away, using the <a href="doc/fromDyalog.html">BQN-Dyalog APL</a> or <a href="doc/fromJ.html">BQN-J</a> dictionary as a quick reference where appropriate. Be aware of two key differences between BQN and existing array languages beyond just the changes of <a href="doc/primitive.html">primitives</a>—if these differences don't seem important to you then you don't understand them! BQN's <a href="doc/based.html">based array model</a> 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 <a href="doc/context.html">syntactic roles</a> 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 <a href="doc/functional.html">functional programming</a>.</p> +<p>A useful tool for both beginners and experienced users is <a href="https://mlochbaum.github.io/bqncrate/"><strong>BQNcrate</strong></a>, 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.</p> |
