diff options
91 files changed, 92 insertions, 92 deletions
diff --git a/docs/commentary/bacon.html b/docs/commentary/bacon.html index 2ac75f55..d2c7ca27 100644 --- a/docs/commentary/bacon.html +++ b/docs/commentary/bacon.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: How to cook bacon</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="how-to-cook-bacon">How to cook bacon</h1> <p><em>In BQN, bacon is American, or side, bacon. The method described here works best with medium to thick cuts, and leaves the bacon uniformly cooked and crispy. If you prefer parts of your bacon chewy and underdone, seek help elsewhere.</em></p> <p>Begin with a heated pan at least as wide as the length of the bacon. Prefer cast iron. Cook somewhat hotter than medium, but in order to avoid sticking, don't let the pan reach full heat before starting. However, there is never any need to lubricate the pan, as grease from the cooking bacon will soon serve this purpose.</p> diff --git a/docs/commentary/fanart.html b/docs/commentary/fanart.html index 04c66c1e..6b005248 100644 --- a/docs/commentary/fanart.html +++ b/docs/commentary/fanart.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN art</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="bqn-art">BQN art</h1> <p><a href="https://codeberg.org/wezl">Wezl</a> has provided a view into the BQN programmer in 𝕩e's typical place of residence.</p> <p><a href="https://ermineii.github.io/paste/#0fZExDoMwDEX3nOKPZPIZWCJ54gA18gWQuvb4dSghjtP2C2XgPcX4k3BHQ9JNCCGSJrSqrhGyl@R6N1H250w3bMD@neph3@lueAaB6lI2uQkUOJPAHm48DjDwqufIqfzMubuvy27XvszVztAnk6p4oypj48yHZubxDywIDiM4yKm13iQphYZZZyWCZe8OCqTPf@RPa6J/Qm8%23DYs7DoMwEAV7n@J1fCQMQenSYeUQlICXZCXYEHuROD4rTTWjWX@iZTHz5@CrqF5YeSOZdjL3Fz8l9XqpBefaGvrlDKNcKgSKiRfCO@0sxIy@6x8OwGZWMkWcEinZQwihGUY8fYe6vQE">Depiction</a>, <a href="https://ermineii.github.io/paste/#0jZA7DsQgDER7TuFyU/kMKUCytsgBMPIFIm27x18gJHxDdoQoeKPBHgVZUktlglCLVYdWkbWDVHg4PXWUyrunG2wAbkxl93MWCZ/GgGEn//NpwIYTMvhDJ28/8OAb7pqjuVXcPbfls6/xiuqKOglFuHZES/FCtMtCtSVOUnkIHj1sDMLAw/ByLjUMBvgYz1q7HEsYp3XYi2UiX4q62nuPlbieSk0jmij4I@k@7gc%23Fcu7CsJAEIXhfp/ikCYXcBODYBFsDD6BlWXcncSBzRg3I0Sf3hVO9R3@icTZVT@B7PgUvfKXcEJ2XDTrzF@K/M7Twltedhg5kAwzJXuJHaJa3TQdxtQV9MEr0gpXoicf2REucWYhZrRNuzcAQlJZyeMtnmJqCH2/O99wsA2q@gc">remodel</a>, <a href="https://ermineii.github.io/paste/#07ZhLbuMwDIavInTVAAV4hmwM/Cujm26qQBco0gFmk@MPqYdFSZbtboJMKsFxYPK3HuRHR87ni1maq5q9Li4yVbM2exfn2blz64aWWRuNrR/6vOKezWzMpeN2Xzxh1cd3rSBZngyfJFQrQOyVD5KkGYY9NzlXApq6LQZCx0@GcHldS7SKGIM4/laLgqpMBPDlTkCdmFdTqWAqlTlxXykXSWbtNFExZAgS614vWWYmtuR5fJ5iKK11G41e3gZqd0aNfAgK1lrUINM1JWstajwPRs0Am6ixm1ErVSuoMWlmmkzJWouakGY0awO1R0WNYgQ0aw1qTFoQFrA1rEFWYR1MwVEDGzuDqsStoQ3pqsCtoS3ApnEbtD0obbTkV@FW0yawRaXGraZNpiEqLwS6uInLy2oua94QhxSdJq4GLvGmiBvA/ffAiWCXN57OEdw8Skdpuw3afh1t4T3ikXHzT8zB21PwRpE39mwChwQcNoFDAg47wIUNIxNHx4ibBnHPQlz4p8TaXeQQkMMOcgjIYR@5sNW70WDu1zHH87X2CHMQ5rDLHI4zJ@0odGYw90TMUQZgBzqkr23matUWcn4Cd0DOUyP3XAuT31hURoqbx2tlK2FLtrNOXk7finFaU0bEUmK1kdaU2DH6pVdG/ydroXQOPpx@q7SYWad5gy9UUDUULdv1@A7gzUzBzMu@5R2YFyOMnzdc0TrLtUPaz6cuQk6R9u9BndIMVbJqxeKmRZzMAYFDIcvGzGiRnIWzwroqLY1OGSklV7HxnZ9TH@X9yUwlmt5KNcTyNGnI5h7FNorgvkXw/oMieB9FMIpg/BKMIhhF8EBFINerhRDCs1oO/qWhVxSO@qUh57lXIaHjTp3w8adbLerOpmb4@NutHN8RjfpZq5/LPw%23PY5NT8MwDIbv/RVWL2kHS8s0CYl@HKiQOMAJLki7ZIlXDKkTNZlE@fWkDGH5ZPl9nndE1jLExaI8OY4v9I3Qgbj1UTSwXgpxpNHTlygbCBiDRzRFLet92WTwN@MKIWacH1@fn1I@b/2MQKYTimlSkRwL@LV0YoVuT2oiu9zBIb/QD/k1TI5d8Eqj6Nsq5fv86t8ACXk8x@gYHGtL@rMT3qqlKEXvwYKCpa0uD32eipNFVhMWwqsQUa4t5EdILVLrLKs2EN8pQNpClzCgmUkjPMwTMRLBrt7drOrkQQ5o4MwG55RBGIbt/RvsZQ2b6gc">animation</a>.</p> diff --git a/docs/commentary/history.html b/docs/commentary/history.html index f8ddcdfd..d4b01d0b 100644 --- a/docs/commentary/history.html +++ b/docs/commentary/history.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN's development history</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="bqns-development-history">BQN's development history</h1> <p>I (<a href="https://mlochbaum.github.io/">Marshall Lochbaum</a>) began designing BQN as a "fixed APL" in collaboration with my colleagues at <a href="https://aplwiki.com/wiki/Dyalog_Ltd.">Dyalog</a>, and decided to take it on as a personal project when I chose to leave the company several months later in early 2020. BQN is influenced by my array language background, previous work in programming design, studies of APL history, and design discussions before and after starting work on the language. I developed most of the novel functionality in BQN, and am at the end of the day the one who writes the spec, but it includes significant contributions from collaborators, most notably <a href="https://github.com/dzaima">dzaima</a> and <a href="https://github.com/abrudz">Adám Brudzewsky</a>.</p> <h3 id="background">Background</h3> diff --git a/docs/commentary/index.html b/docs/commentary/index.html index f259f441..c85c41fe 100644 --- a/docs/commentary/index.html +++ b/docs/commentary/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN commentary</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="bqn-commentary">BQN commentary</h1> <p>Documents in this directory give context on how BQN was designed or remark on aspects of the language.</p> <ul> diff --git a/docs/commentary/orchard.html b/docs/commentary/orchard.html index 4f07c20d..12b5b9a9 100644 --- a/docs/commentary/orchard.html +++ b/docs/commentary/orchard.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: The APL Orchard</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="the-apl-orchard">The APL Orchard</h1> <p>BQN users have largely moved to Matrix or Discord chat, and I no longer recommend using the APL Orchard (perhaps also known by the shortcut URL apl.chat). Chat options are discussed <a href="../index.html#where-can-i-find-bqn-users">in the README</a>; this page gives the reasons we switched forums.</p> <p>StackExchange chat requires a StackExchange account with enough reputation, or moderator-granted permissions, to talk, and sets a reputation threshold for some minor features within the chat as well. Those who don't use StackExchange have to make an account and send an email to get permission. While this filtering probably leads to a more dedicated forum base, it does this at the expense of keeping out a lot of people, including many who have a lot to contribute. I think this isn't a good tradeoff, and this seems to be the community concensus as well.</p> diff --git a/docs/commentary/primitive.html b/docs/commentary/primitive.html index ad6d4665..fbbd4d5d 100644 --- a/docs/commentary/primitive.html +++ b/docs/commentary/primitive.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: What is a primitive?</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="what-is-a-primitive">What is a primitive?</h1> <p>People sometimes wonder how the set of primitives in BQN was chosen. Outsiders to array programming might assume that the "big idea" of APL is just to take the most common tasks and write them with symbols instead of names—even Dijkstra said something like this, calling APL a "bag of tricks"! I don't think this is quite right, so I'd like to explain my personal view on why it makes sense to call a few special operations "primitives" and give them dedicated symbols. While I think this overlaps some with the ideas of other array designers, I am speaking only for myself here.</p> <h2 id="names-versus-symbols">Names versus symbols</h2> diff --git a/docs/commentary/problems.html b/docs/commentary/problems.html index 0518a34f..8647bd09 100644 --- a/docs/commentary/problems.html +++ b/docs/commentary/problems.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Problems with BQN</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">commentary</a></div> +<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="problems-with-bqn">Problems with BQN</h1> <p>Every language has some issues that everyone can agree make programming harder. Sometimes there is a simple solution that has not yet been discovered; sometimes the problem is inherent to the language because it's caused by fundamental choices (or anywhere in between). Below are problems I have identified in BQN, ordered from what I consider the most severe to the least. This is independent of whether the issue can be solved—if it somehow went away, how much better would the language be?</p> <p>I've omitted problems that are obviously addressed by speculated extensions. Of course adding A fixes the problem "doesn't have A". Problems that only exist in reference to some existing convention (e.g. unfamiliarity to APLers) are also left out, unless the convention manifests technically (Unicode support).</p> diff --git a/docs/doc/arithmetic.html b/docs/doc/arithmetic.html index 42bf677a..0be70506 100644 --- a/docs/doc/arithmetic.html +++ b/docs/doc/arithmetic.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Arithmetic functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="arithmetic-functions">Arithmetic functions</h1> <p>BQN's arithmetic functions use mostly the same symbols as APL, and the functionality is actually defined by the language implementation's number system and not the specification, so there's not too much to say about them.</p> <p>Summary of differences for APLers:</p> diff --git a/docs/doc/array.html b/docs/doc/array.html index 9cf74517..001a9f70 100644 --- a/docs/doc/array.html +++ b/docs/doc/array.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: The array</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="the-array">The array</h1> <p>As BQN is an array language, it's often helpful to understand what an array is when writing BQN programs. Fully describing the concept is sometimes <a href="https://www.jsoftware.com/papers/array.htm">held to be tricky</a>; here we'll see definitions, examples, and metaphors.</p> <p>In BQN, as in APL, arrays are multidimensional, instead of strictly linear. Languages like Python, Javascript, or Haskell offer only one-dimensional arrays with <code><span class='Value'>[]</span></code> syntax, and typically represent multidimensional data with nested arrays. Multidimensional arrays have fundamental differences relative to this model.</p> diff --git a/docs/doc/arrayrepr.html b/docs/doc/arrayrepr.html index 99c485f7..55598a6a 100644 --- a/docs/doc/arrayrepr.html +++ b/docs/doc/arrayrepr.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Array notation and display</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="array-notation-and-display">Array notation and display</h1> <p>This page documents ways arrays are represented in BQN: the notation you can use to write them and the way the REPL displays them.</p> <p>Array display is a feature of a BQN environment such as a REPL. You can also access it with <code><span class='Function'>•Fmt</span></code>, which takes a value and returns a string indicating how it would be formatted. Array notation is of course part of BQN source code, but you can also go from an array to one possible source code for it using the similar system function <code><span class='Function'>•Repr</span></code>.</p> diff --git a/docs/doc/assert.html b/docs/doc/assert.html index 35ae159c..7630f925 100644 --- a/docs/doc/assert.html +++ b/docs/doc/assert.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Assert</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="assert">Assert</h1> <p>BQN takes the position that errors exist to indicate exceptional conditions that the developer of a given program didn't expect. However, the types of errors that BQN naturally checks for, such as mismatched shapes in Couple (<code><span class='Function'>≍</span></code>), aren't always enough to detect exceptional conditions. Issues like numeric values that don't make physical sense will slip right through. BQN makes it easy for a programmer to check for these sorts of problems by building in the primitive Assert, written <code><span class='Function'>!</span></code>. This function checks whether <code><span class='Value'>𝕩</span></code> matches <code><span class='Number'>1</span></code>: if it does, then it does nothing and returns <code><span class='Value'>𝕩</span></code>, and otherwise it gives an error.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ISAyPTIgICMgUGFzc2VkCiEgMj0zICAjIEZhaWxlZA==">↗️</a><pre> <span class='Function'>!</span> <span class='Number'>2</span><span class='Function'>=</span><span class='Number'>2</span> <span class='Comment'># Passed diff --git a/docs/doc/based.html b/docs/doc/based.html index c2959b19..6fce0526 100644 --- a/docs/doc/based.html +++ b/docs/doc/based.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Based array theory</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="based-array-theory">Based array theory</h1> <style>code span.Comment { color: inherit; }</style> <p><em>"Like a normal programming language"</em></p> diff --git a/docs/doc/block.html b/docs/doc/block.html index cd124aa9..82547a15 100644 --- a/docs/doc/block.html +++ b/docs/doc/block.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Blocks</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="blocks">Blocks</h1> <p>In BQN, a <em>block</em> is any piece of code surrounded with curly braces <code><span class='Brace'>{}</span></code>. Blocks can be used simply to group statements, or can define functions or modifiers. They are the sole large-scale structure used to organize programs.</p> <p>Blocks are most commonly used to define functions by including one of the special names for arguments, <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code>. With the operands <code><span class='Function'>𝔽</span></code> or <code><span class='Function'>𝔾</span></code>, they can also define 1-modifiers or 2-modifiers.</p> diff --git a/docs/doc/context.html b/docs/doc/context.html index 1e73eced..35705a7e 100644 --- a/docs/doc/context.html +++ b/docs/doc/context.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN's context-free grammar</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqns-context-free-grammar">BQN's context-free grammar</h1> <p>APL has a problem. To illustrate, let's look at an APL expression:</p> <pre><span class='Value'>a</span> <span class='Value'>b</span> <span class='Value'>c</span> <span class='Value'>d</span> <span class='Value'>e</span> diff --git a/docs/doc/control.html b/docs/doc/control.html index 9dc6e2a8..ce33ddb6 100644 --- a/docs/doc/control.html +++ b/docs/doc/control.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Control flow in BQN</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="control-flow-in-bqn">Control flow in BQN</h1> <p>BQN does not have ALGOL-style control structures. Instead, functional techniques can be used to control when code is evaluated. This page describes how BQN functionality can be used to emulate something more familiar to an imperative programmer.</p> <p>Control structures here are always functions that act on lists of functions, although alternatives might be presented. This is because stranded functions can be formatted in a very similar way to blocks in curly-brace languages. However, there are many ways to write control flow, including simple operators and a mix of operators and more control-structure-like code. Implementing a control structure rarely takes much code with any method, so there are usually several simple ways to implement a given flow or a variation of it.</p> diff --git a/docs/doc/couple.html b/docs/doc/couple.html index 1923e9d1..8bc54ef5 100644 --- a/docs/doc/couple.html +++ b/docs/doc/couple.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Couple and Merge</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="couple-and-merge">Couple and Merge</h1> <p>Solo/Couple (<code><span class='Function'>≍</span></code>) and Merge (<code><span class='Function'>></span></code>) are functions that create a higher-rank array from lower-rank components. Each takes some number of inner arrays organized in an outer structure, and creates a single array combining all elements of those inner arrays. For example, let's couple two arrays of shape <code><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span></code>:</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHAg4oaQIDPigL81w5fijJzihpUzCuKKoiBxIOKGkCAy4oC/M+KliiJhYmNkZWYiCnAg4omNIHEgICAjIHAgY291cGxlZCB0byBxCuKJoiBwIOKJjSBx">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>p</span> <span class='Gets'>←</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Function'>×</span><span class='Modifier'>⌜</span><span class='Function'>↕</span><span class='Number'>3</span> diff --git a/docs/doc/depth.html b/docs/doc/depth.html index 4c5ca982..c2501726 100644 --- a/docs/doc/depth.html +++ b/docs/doc/depth.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Depth</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="depth">Depth</h1> <svg viewBox='-278.4 -45.6 556.8 193.8'> <g font-family='BQN,monospace' font-size='16px' text-anchor='middle' fill='currentColor' stroke-width='0' stroke='currentColor' stroke-linecap='round'> diff --git a/docs/doc/embed.html b/docs/doc/embed.html index 31a5f22e..e0f48dc2 100644 --- a/docs/doc/embed.html +++ b/docs/doc/embed.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Using embedded BQN</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="using-embedded-bqn">Using embedded BQN</h1> <p>The Javascript implementation of BQN, <a href="https://github.com/mlochbaum/BQN/blob/master/doc/../docs/bqn.js">docs/bqn.js</a>, can be <a href="https://mlochbaum.github.io/BQN/try.html">used</a> as a standalone interpreter, but it can also be called from JS, which in combination with BQN's first-class functions allows the two language to interoperate well. Similar functionality will most likely be brought to other host languages in the future. Languages that (like JS) allow functions and arrays to be tagged with extra properties can host a full BQN implementation with good interoperability. Other languages would either require functions and arrays to be stored in specialized data structures, making interoperability a little harder, or would miss out on some inferred properties like function inverses and array fills.</p> <p>There is only one mechanism to interface between the host language and BQN: the function <code><span class='Value'>bqn</span></code> evaluates a string containing a BQN program and returns the result. Doesn't sound like much, especially considering these programs can't share any state such as global variables (BQN doesn't have those). But taking first-class functions and closures into account, it's all you could ever need!</p> diff --git a/docs/doc/enclose.html b/docs/doc/enclose.html index ce7d6cf9..2be9bddb 100644 --- a/docs/doc/enclose.html +++ b/docs/doc/enclose.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Enclose</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="enclose">Enclose</h1> <p>The function enclose creates a unit array whose only element is <code><span class='Value'>𝕩</span></code>.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=PCAieHl6Ig==">↗️</a><pre> <span class='Function'><</span> <span class='String'>"xyz"</span> diff --git a/docs/doc/expression.html b/docs/doc/expression.html index 7597fe4c..20eb896e 100644 --- a/docs/doc/expression.html +++ b/docs/doc/expression.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Expression syntax</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="expression-syntax">Expression syntax</h1> <p>BQN expressions are the part of <a href="syntax.html">syntax</a> that describes computations to perform. Programs are mainly made up of expressions with a little organizing material like <a href="block.html">blocks</a> and <a href="namespace.html">namespaces</a> around them. This page explains how functions, modifiers, and assignment combine with their inputs. It doesn't describe <a href="syntax.html#constant">constant</a> and <a href="arrayrepr.html#list-literals">array</a> literals, which each form a single subject for grammatical purposes.</p> <p>The <a href="../tutorial/expression.html">first tutorial</a> also covers how to build and read BQN expressions.</p> diff --git a/docs/doc/fill.html b/docs/doc/fill.html index e77872c4..b4ac35ef 100644 --- a/docs/doc/fill.html +++ b/docs/doc/fill.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Fill elements</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="fill-elements">Fill elements</h1> <p>A few array operations need an array element to use when no existing element applies. BQN tries to maintain a "default" element for every array, known as a fill element, for this purpose. If it's known, the fill element is a nested array structure where each atom is either <code><span class='Number'>0</span></code> or <code><span class='String'>' '</span></code>. If no fill is known, a function that requests it results in an error.</p> <p>Fills are used by <a href="take.html">Take</a> (<code><span class='Function'>↑</span></code>) when a value in <code><span class='Value'>𝕨</span></code> is larger than the corresponding length in <code><span class='Value'>𝕩</span></code>, by the two <a href="shift.html">Nudge</a> functions (<code><span class='Function'>»«</span></code>) when <code><span class='Value'>𝕩</span></code> is non-empty, by <a href="couple.html">Merge</a> (<code><span class='Function'>></span></code>) when <code><span class='Value'>𝕩</span></code> is empty, and by <a href="reshape.html">Reshape</a> (<code><span class='Function'>⥊</span></code>) when <code><span class='Value'>𝕨</span></code> contains <code><span class='Function'>↑</span></code>. Except for these specific cases, the fill value an array has can't affect the program. The result of <a href="match.html">Match</a> (<code><span class='Function'>≡</span></code>) doesn't depend on fills, and any attempt to compute a fill can't cause side effects.</p> diff --git a/docs/doc/find.html b/docs/doc/find.html index 1421500e..689d8415 100644 --- a/docs/doc/find.html +++ b/docs/doc/find.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Find</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="find">Find</h1> <p>Find (<code><span class='Function'>⍷</span></code>) searches for occurrences of an array <code><span class='Value'>𝕨</span></code> within <code><span class='Value'>𝕩</span></code>. The result contains a boolean for each possible location, which is 1 if <code><span class='Value'>𝕨</span></code> was found there and 0 if not.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Inh4IiDijbcgInh4YmR4eHhjeCI=">↗️</a><pre> <span class='String'>"xx"</span> <span class='Function'>⍷</span> <span class='String'>"xxbdxxxcx"</span> diff --git a/docs/doc/fold.html b/docs/doc/fold.html index 7c2703c8..2890eb4d 100644 --- a/docs/doc/fold.html +++ b/docs/doc/fold.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Fold and Insert</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="fold-and-insert">Fold and Insert</h1> <svg viewBox='-184.8 -12 588 288'> <g font-size='21px' fill='currentColor' stroke-linecap='round' text-anchor='middle' font-family='BQN,monospace'> diff --git a/docs/doc/fromDyalog.html b/docs/doc/fromDyalog.html index 4568fd31..1662a543 100644 --- a/docs/doc/fromDyalog.html +++ b/docs/doc/fromDyalog.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN–Dyalog APL dictionary</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqndyalog-apl-dictionary">BQN–Dyalog APL dictionary</h1> <p>A few tables to help users of Dyalog APL (or similar) get started quickly on BQN. Here we assume <code><span class='Value'>⎕</span><span class='Function'>ML</span></code> is 1 for Dyalog.</p> <h2 id="terminology">Terminology</h2> diff --git a/docs/doc/fromJ.html b/docs/doc/fromJ.html index 3dcb7473..46d312be 100644 --- a/docs/doc/fromJ.html +++ b/docs/doc/fromJ.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN–J dictionary</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqnj-dictionary">BQN–J dictionary</h1> <style>.Comment { color: inherit; }</style> <p>A guide to help users of J get up to speed with BQN quickly.</p> diff --git a/docs/doc/functional.html b/docs/doc/functional.html index 50d70af5..1595e5ae 100644 --- a/docs/doc/functional.html +++ b/docs/doc/functional.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Functional programming</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="functional-programming">Functional programming</h1> <p>BQN boasts of its functional capabilities, including first-class functions. What sort of functional support does it have, and how can a BQN programmer exercise these and out themself as a Schemer at heart?</p> <p>First, let's be clear about what the terms we're using mean. A language has <em>first-class functions</em> when functions (however they are defined) can be used in all the same ways as "ordinary" values like numbers and so on, such as being passed as an argument or placed in a list. Lisp and JavaScript have first-class functions, C has unsafe first-class functions via function pointers, and Java 7 and APL don't have them as functions can't be placed in lists or used as arguments. This doesn't mean every operation is supported on functions: for instance, numbers can be added, compared, and sorted; while functions could perhaps be added to give a train, comparing or sorting them as functions (not representations) isn't computable, and BQN doesn't support any of the three operations when passing functions as arguments.</p> diff --git a/docs/doc/glossary.html b/docs/doc/glossary.html index 99e96d32..b24ce012 100644 --- a/docs/doc/glossary.html +++ b/docs/doc/glossary.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN glossary</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqn-glossary">BQN glossary</h1> <p>Below are short, and sometimes vague, definitions of terms used to describe BQN code.</p> <h2 id="types">Types</h2> diff --git a/docs/doc/group.html b/docs/doc/group.html index a6f4b341..1e3afd03 100644 --- a/docs/doc/group.html +++ b/docs/doc/group.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Group</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="group">Group</h1> <p>BQN replaces the Key operator from J or Dyalog APL, and <a href="https://aplwiki.com/wiki/Partition_representations">many forms of partitioning</a>, with a single (ambivalent) Group function <code><span class='Function'>⊔</span></code>. This function is somewhat related to the K function <code><span class='Function'>=</span></code> of the same name, but results in an array rather than a dictionary.</p> <svg viewBox='-344 -121.8 640 226.8'> diff --git a/docs/doc/identity.html b/docs/doc/identity.html index ec710ab6..36795e61 100644 --- a/docs/doc/identity.html +++ b/docs/doc/identity.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Identity functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="identity-functions">Identity functions</h1> <p>Here are the simplest functions in BQN: Right (<code><span class='Function'>⊢</span></code>) always returns its right argument, and Left (<code><span class='Function'>⊣</span></code>) returns its left argument if called with two arguments, and the right argument otherwise.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiICJvbmx5IgoK4oqjICJvbmx5IgoKImxlZnQiIOKKoiAicmlnaHQiCgoibGVmdCIg4oqjICJyaWdodCI=">↗️</a><pre> <span class='Function'>⊢</span> <span class='String'>"only"</span> diff --git a/docs/doc/index.html b/docs/doc/index.html index 737ff56d..ec0e46eb 100644 --- a/docs/doc/index.html +++ b/docs/doc/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN documentation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="bqn-documentation">BQN documentation</h1> <p>BQN's documentation describes what features it has, how to use them (with examples), and why they were chosen. For a linear introduction to the language, see the <a href="../tutorial/index.html">tutorials</a>. While the core language <a href="../spec/index.html">specification</a> is complete, the documentation still has minor gaps.</p> <p>Overview:</p> diff --git a/docs/doc/indices.html b/docs/doc/indices.html index 5a0836d9..fe67492d 100644 --- a/docs/doc/indices.html +++ b/docs/doc/indices.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Indices</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="indices">Indices</h1> <p>One-dimensional arrays such as K lists or Python arrays have only one kind of index, a single number that refers to an element. For <a href="array.html">multidimensional arrays</a> using the <a href="leading.html">leading axis theory</a>, there are several types of indexing that can be useful. Historically, nested APL designs have equivocated between these, which I believe can lead to subtle errors when programming. BQN focuses on single-number (atomic) indices, which can refer to list elements or array major cells (or more generally indexing along any particular axis). When using atomic indices to select elements, the indexed array has to be a list. In contrast, elements of any array can be indicated by list indices with length equal to that array's rank. Only two BQN primitives use these list indices: <a href="range.html">Range</a> (<code><span class='Function'>↕</span></code>), which returns an array of them if given a list argument, and <a href="pick.html">Pick</a> (<code><span class='Function'>⊑</span></code>), where the depth-1 components of an array left argument are list indices.</p> <p>The following functions take or return indices. Except where marked, the indices are in the result; this is by far the most common type of index use. <a href="group.html">Group</a> (<code><span class='Function'>⊔</span></code>) is given two rows as it falls into both cases. Note that in the result case, there is usually no possibility for the programmer to select the format of indices. Instead, the language should be carefully designed to make sure that the kind of index returned is as useful as possible.</p> diff --git a/docs/doc/join.html b/docs/doc/join.html index c3de72ae..414f19b0 100644 --- a/docs/doc/join.html +++ b/docs/doc/join.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Join and Join To</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="join-and-join-to">Join and Join To</h1> <p>The glyph <code><span class='Function'>∾</span></code> combines arrays along an existing axis, a concept that other languages might call "concatenation" or "catenation" but BQN names "Join". The one-argument form Join and two-argument form Join To are parallel to <a href="couple.html">the functions</a> that combine arrays along a new axis, Merge (<code><span class='Function'>></span></code>) and Couple (<code><span class='Function'>≍</span></code>).</p> <h2 id="join-to">Join To</h2> diff --git a/docs/doc/leading.html b/docs/doc/leading.html index 51f29e38..ac7d2d49 100644 --- a/docs/doc/leading.html +++ b/docs/doc/leading.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: The leading axis convention</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="the-leading-axis-convention">The leading axis convention</h1> <p>Several primitive functions manipulate the right argument, or sometimes both arguments, of an <a href="array.html">array</a> along one or more axes. According to the <a href="https://aplwiki.com/wiki/Leading_axis_theory">leading axis model</a>, it's best to make the primitives operate on initial axes, because the Rank modifier then allows it to apply to later axes as well. Here we'll see how this pattern works in BQN.</p> <h2 id="monadic-functions">Monadic functions</h2> diff --git a/docs/doc/lexical.html b/docs/doc/lexical.html index d65f269b..2ce2cfc9 100644 --- a/docs/doc/lexical.html +++ b/docs/doc/lexical.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Lexical scoping</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="lexical-scoping">Lexical scoping</h1> <p>BQN uses lexical scope, like most modern functional programming languages including Javascript, Scheme, and Julia, and like Dyalog APL's dfns (tradfns are dynamically scoped). This document describes how lexical scoping works, and a few small details relevant to BQN's version of it.</p> <p>In short, every <a href="block.html">block</a> is a separate scope that can refer to identifiers in containing scopes. When evaluated, the block makes a variable for each identifier defined in it (including arguments and operands). The blocks that it contains will now access these variables. In the first level of a block, variables must be defined before they can be used, but in child blocks, a variable can be used regardless of where it's defined, as long as the definition is evaluated before the child block is.</p> diff --git a/docs/doc/logic.html b/docs/doc/logic.html index ef42070d..2635814c 100644 --- a/docs/doc/logic.html +++ b/docs/doc/logic.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN Logic functions: And, Or, Not (also Span)</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="logic-functions-and-or-not-also-span">Logic functions: And, Or, Not (also Span)</h1> <p>BQN retains the APL symbols <code><span class='Function'>∧</span></code> and <code><span class='Function'>∨</span></code> for logical <em>and</em> and <em>or</em>, and changed APL's <code><span class='Value'>~</span></code> to <code><span class='Function'>¬</span></code> for <em>not</em>, since <code><span class='Value'>~</span></code> looks too much like <code><span class='Modifier'>˜</span></code> and <code><span class='Function'>¬</span></code> is more common in mathematics today. Like J, BQN extends Not to the linear function <code><span class='Number'>1</span><span class='Modifier2'>⊸</span><span class='Function'>-</span></code>. However, it discards <a href="https://aplwiki.com/wiki/GCD">GCD</a> and <a href="https://aplwiki.com/wiki/LCM">LCM</a> as extensions of And and Or, and instead uses bilinear extensions: And is identical to Times (<code><span class='Function'>×</span></code>), while Or is <code><span class='Function'>×</span><span class='Modifier2'>⌾</span><span class='Function'>¬</span></code>, following De Morgan's laws (other ways of obtaining a function for Or give an equivalent result—there is only one bilinear extension).</p> <p>If the arguments are probabilities of independent events, then an extended function gives the probability of the boolean function on their outcomes (for example, if <em>A</em> occurs with probability <code><span class='Value'>a</span></code> and <em>B</em> with probability <code><span class='Value'>b</span></code> independent of <em>A</em>, then <em>A</em> or <em>B</em> occurs with probability <code><span class='Value'>a</span><span class='Function'>∨</span><span class='Value'>b</span></code>). These extensions have also been used in complexity theory, because they allow mathematicians to transfer a logical circuit from the discrete to the continuous domain in order to use calculus on it.</p> diff --git a/docs/doc/map.html b/docs/doc/map.html index f228e3df..91c27caf 100644 --- a/docs/doc/map.html +++ b/docs/doc/map.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Mapping modifiers</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="mapping-modifiers">Mapping modifiers</h1> <p>Mapping a function over an array means to call it on each element of that array, creating an array of results. It's also possible to map over two arrays, applying the function to various choices of one element from each, but there's no longer a single correct way to iterate over these elements.</p> <p>BQN has two 1-modifiers to map over arrays: Each (<code><span class='Modifier'>¨</span></code>) and Table (<code><span class='Modifier'>⌜</span></code>). On two arguments, Table applies its operand to all combinations of elements while Each creates a one-to-one or one-to-many matching. Since they apply to elements, these modifiers are different from Cells (<code><span class='Modifier'>˘</span></code>) or its generalization Rank (<code><span class='Modifier2'>⎉</span></code>), which apply the function to array cells. The modifier <a href="depth.html#the-depth-modifier">Depth</a> (<code><span class='Modifier2'>⚇</span></code>) is a generalization of Each, so that <code><span class='Modifier'>¨</span></code> is <code><span class='Modifier2'>⚇</span><span class='Number'>¯1</span></code>; however, it can't be used to implement Table without some additional array operations.</p> diff --git a/docs/doc/match.html b/docs/doc/match.html index 3fd112f0..74fc83a3 100644 --- a/docs/doc/match.html +++ b/docs/doc/match.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Match</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="match">Match</h1> <p>The primitive Match (<code><span class='Function'>≡</span></code>) tests whether its two argument arrays are considered equivalent in BQN, returning <code><span class='Number'>1</span></code> if so and <code><span class='Number'>0</span></code> otherwise. Not Match (<code><span class='Function'>≢</span></code>) is the opposite, returning <code><span class='Number'>1</span></code> if the two arrays aren't equivalent and <code><span class='Number'>0</span></code> if they are.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFiYyIg4omhICdhJ+KAvydiJ+KAvydjJwo0IOKJoiA8NA==">↗️</a><pre> <span class='String'>"abc"</span> <span class='Function'>≡</span> <span class='String'>'a'</span><span class='Ligature'>‿</span><span class='String'>'b'</span><span class='Ligature'>‿</span><span class='String'>'c'</span> diff --git a/docs/doc/namespace.html b/docs/doc/namespace.html index 9ea2f214..667e323d 100644 --- a/docs/doc/namespace.html +++ b/docs/doc/namespace.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Namespaces</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="namespaces">Namespaces</h1> <p>A namespace is a type of value that groups together several values (fields) from the same scope. A block or file returns a namespace if it contains any export arrows <code><span class='Gets'>⇐</span></code> at the top level, and fields from namespaces can be accessed with either dot syntax or destructuring assignment. A namespace can be mutable only if any of the code in it uses <code><span class='Gets'>↩</span></code> to change the value of a field.</p> <p>The following quick example shows a few ways to use a namespace returned by <code><span class='Function'>•Import</span></code>:</p> diff --git a/docs/doc/oop.html b/docs/doc/oop.html index 59a6c851..916a4eef 100644 --- a/docs/doc/oop.html +++ b/docs/doc/oop.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Object-oriented programming in BQN</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="object-oriented-programming-in-bqn">Object-oriented programming in BQN</h1> <p>BQN's <a href="namespace.html">namespaces</a> can be used to support a simple form of <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">object-oriented programming</a> (OOP) without type checking or inheritance. It's suitable for some program architectures but not others: making OOP work as a solution to every problem isn't a BQN design goal. In fact, BQN was never designed to support OOP at all! I added namespaces or modules as a way to structure programs. The techniques we're going to discuss are all just ways to use namespaces, and if it ever starts seeming like confusing magic it might help to go back to this model. However, thinking of namespaces as objects can be quite powerful in the right circumstances, and on this page I'm going to frame things in OOP terms. The following table shows which well-known aspects of OOP are supported in BQN:</p> <table> diff --git a/docs/doc/order.html b/docs/doc/order.html index 3b281ee3..1737ebd1 100644 --- a/docs/doc/order.html +++ b/docs/doc/order.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Ordering functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="ordering-functions">Ordering functions</h1> <p>BQN has six functions that order arrays as part of their operation (the <a href="arithmetic.html#comparisons">comparison functions</a> <code><span class='Function'>≤<>≥</span></code> only order atoms, so they aren't included). These come in three pairs, where one of each pair uses an ascending ordering and the other uses a descending ordering.</p> <ul> diff --git a/docs/doc/paradigms.html b/docs/doc/paradigms.html index 9e2538f2..73fe750c 100644 --- a/docs/doc/paradigms.html +++ b/docs/doc/paradigms.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN in programming paradigms</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqn-in-programming-paradigms">BQN in programming paradigms</h1> <p>It hangs onto weakly positive connotations somehow, but the term "multi-paradigm" shouldn't impress you. Let's dig into exactly which paradigms BQN supports and how.</p> <p>This information doesn't tell you what tasks BQN is good for: after all, it turns out you can write an efficient compiler entirely using array programming, something many people assumed was impossible. Instead, it tells you what approaches you can take to writing programs, and how comfortable you'll find it to start using BQN—or how much you can use it to stretch your brain in new directions.</p> diff --git a/docs/doc/pick.html b/docs/doc/pick.html index a296d6c0..76f9bfe9 100644 --- a/docs/doc/pick.html +++ b/docs/doc/pick.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Pick</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="pick">Pick</h1> <p>Pick (<code><span class='Function'>⊑</span></code>) chooses elements from <code><span class='Value'>𝕩</span></code> based on <a href="indices.html">index</a> lists from <code><span class='Value'>𝕨</span></code>. <code><span class='Value'>𝕨</span></code> can be a plain list, or even one number if <code><span class='Value'>𝕩</span></code> is a list, in order to get one element from <code><span class='Value'>𝕩</span></code>. It can also be an array of index lists, or have deeper array structure: each index list will be replaced with the element of <code><span class='Value'>𝕩</span></code> at that index, effectively applying to <code><span class='Value'>𝕨</span></code> at <a href="depth.html#the-depth-modifier">depth</a> 1.</p> <p>With no <code><span class='Value'>𝕨</span></code>, monadic <code><span class='Function'>⊑</span><span class='Value'>𝕩</span></code> takes the first element of <code><span class='Value'>𝕩</span></code> in index order, with an error if <code><span class='Value'>𝕩</span></code> is empty.</p> diff --git a/docs/doc/prefixes.html b/docs/doc/prefixes.html index 9732fe90..59e94b21 100644 --- a/docs/doc/prefixes.html +++ b/docs/doc/prefixes.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Prefixes and Suffixes</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="prefixes-and-suffixes">Prefixes and Suffixes</h1> <p>The Prefixes (<code><span class='Function'>↑</span></code>) function gives a list of all prefixes of its argument array along the <a href="leading.html">first axis</a>, and Suffixes (<code><span class='Function'>↓</span></code>) gives a similar list for suffixes. Because the result can be much larger than the argument, these functions may not be used often in high-performance code, but they are a powerful conceptual tool and can make sense for algorithms that are inherently quadratic.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaRICJhYmNkZSIK4oaTICJhYmNkZSI=">↗️</a><pre> <span class='Function'>↑</span> <span class='String'>"abcde"</span> diff --git a/docs/doc/primitive.html b/docs/doc/primitive.html index 4c6ef8a8..ef7f8d86 100644 --- a/docs/doc/primitive.html +++ b/docs/doc/primitive.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN primitives</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="bqn-primitives">BQN primitives</h1> <p><em>Primitives</em> are the basic functions and modifiers built into the language, written with individual glyphs (more about the concept <a href="../commentary/primitive.html">here</a>). The role of a primitive when written always matches its type (but you can use its value in other roles by assigning it, or other methods).</p> <p>Primitives have no side effects other than errors, and can't perform infinite computations, except when a primitive modifier calls an operand function that does one of these things (this can only happen when arguments are passed, as primitive modifiers are always deferred). Side effects here include both writing state such as variables or printed output, and reading any outside state, so that a function without them always returns the same result if passed the same arguments. Since trains and list notation have the same nice properties, tacit code written entirely with primitives, trains, and lists always describes finite, self-contained computations.</p> diff --git a/docs/doc/range.html b/docs/doc/range.html index 0620d0d8..8d73bf0b 100644 --- a/docs/doc/range.html +++ b/docs/doc/range.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Range</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="range">Range</h1> <p>Range (<code><span class='Function'>↕</span></code>) is a monadic function that creates arrays of <a href="indices.html">indices</a> (like APL's famous <a href="https://aplwiki.com/wiki/Index_Generator">iota</a> function). Each element in the result is its own index.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaVIDYKCuKGlSAy4oC/Mw==">↗️</a><pre> <span class='Function'>↕</span> <span class='Number'>6</span> diff --git a/docs/doc/repeat.html b/docs/doc/repeat.html index bfbe28e5..aaa68219 100644 --- a/docs/doc/repeat.html +++ b/docs/doc/repeat.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: The Repeat modifier</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="the-repeat-modifier">The Repeat modifier</h1> <p>Repeat (<code><span class='Modifier2'>⍟</span></code>) is a 2-modifier that applies its operand function <code><span class='Function'>𝔽</span></code> multiple times.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=wrvCu8K7ICJBQkNERSIKCsK74o2fMyAiQUJDREUi">↗️</a><pre> <span class='Function'>»»»</span> <span class='String'>"ABCDE"</span> diff --git a/docs/doc/replicate.html b/docs/doc/replicate.html index 31e76b28..844b67c9 100644 --- a/docs/doc/replicate.html +++ b/docs/doc/replicate.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Indices and Replicate</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="indices-and-replicate">Indices and Replicate</h1> <svg viewBox='-134.4 -37.4 595.2 198'> <g font-family='BQN,monospace' font-size='18px' text-anchor='middle'> diff --git a/docs/doc/reshape.html b/docs/doc/reshape.html index c8e486fa..58b7dece 100644 --- a/docs/doc/reshape.html +++ b/docs/doc/reshape.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Deshape and Reshape</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="deshape-and-reshape">Deshape and Reshape</h1> <svg viewBox='-64 -15 608 377'> <g fill='currentColor' stroke-linecap='round' font-family='BQN,monospace'> diff --git a/docs/doc/reverse.html b/docs/doc/reverse.html index 4fc5165a..104a7e44 100644 --- a/docs/doc/reverse.html +++ b/docs/doc/reverse.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Reverse and Rotate</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="reverse-and-rotate">Reverse and Rotate</h1> <p>The symbol <code><span class='Function'>⌽</span></code> indicates two different array transformations: with no left argument, it reverses the major cells of the array, but with a left argument, it rotates or cycles them around. These two possibilities, first put together in very early versions of APL, can't be considered restrictions or different views of some unifying function, but there are connections between them. Each returns an array with the same <a href="shape.html">shape</a> and all the same elements as <code><span class='Value'>𝕩</span></code>, possibly in a different arrangement. And elements that start out next to each other in <code><span class='Value'>𝕩</span></code> generally stay next to each other—always, if we consider an element on one edge to be next to the one opposite to it. One might think of them as <a href="https://en.wikipedia.org/wiki/Isometry">isometries</a> preserving a discrete subgroup of the torus, if one were inclined to think such things. On major cells, the two functions decompose the <a href="https://en.wikipedia.org/wiki/Dihedral_group">dihedral group</a> okay I'll stop.</p> <p>Many uses of Rotate in APL are better handled by <a href="shift.html">shift</a> functions in BQN. If there's no reason to treat the data as cyclic or periodic, it's best to avoid Rotate.</p> diff --git a/docs/doc/scan.html b/docs/doc/scan.html index cc806de6..4b168b89 100644 --- a/docs/doc/scan.html +++ b/docs/doc/scan.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Scan</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="scan">Scan</h1> <svg viewBox='-184.8 -12.6 588 285.6'> <g fill='currentColor' stroke-linecap='round' text-anchor='middle' font-family='BQN,monospace'> diff --git a/docs/doc/search.html b/docs/doc/search.html index 20b19ac7..accd54fa 100644 --- a/docs/doc/search.html +++ b/docs/doc/search.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Search functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="search-functions">Search functions</h1> <svg viewBox='-124.8 -46.8 532.8 280.8'> <defs> diff --git a/docs/doc/select.html b/docs/doc/select.html index 61a0f38d..63a55e1e 100644 --- a/docs/doc/select.html +++ b/docs/doc/select.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Select</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="select">Select</h1> <svg viewBox='-148.8 -17.4 480 208.8'> <g font-family='BQN,monospace' font-size='22px' text-anchor='middle'> diff --git a/docs/doc/selfcmp.html b/docs/doc/selfcmp.html index 8e9540f2..432cd7c4 100644 --- a/docs/doc/selfcmp.html +++ b/docs/doc/selfcmp.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Self-search functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="self-search-functions">Self-search functions</h1> <svg viewBox='-115.2 -33 676.8 299.2'> <defs> diff --git a/docs/doc/shape.html b/docs/doc/shape.html index 118353c6..99a4260e 100644 --- a/docs/doc/shape.html +++ b/docs/doc/shape.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Array dimensions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="array-dimensions">Array dimensions</h1> <p>The function Shape (<code><span class='Function'>≢</span></code>) returns an array's shape, and Rank (<code><span class='Function'>=</span></code>) and Length (<code><span class='Function'>≠</span></code>) return properties that can be derived from the shape. BQN's arrays are multidimensional, so that the shape is a list of natural numbers (the length along each axis), while the rank (length of the shape) and length (of the first axis) are numbers. In these functions, an atom is treated as a unit array, which has rank 0 and empty shape. A unit has no first axis, but its length is defined to be 1.</p> <p>Rank can be defined as <code><span class='Function'>≠</span><span class='Modifier2'>∘</span><span class='Function'>≢</span></code> while Length can be defined with a <a href="fold.html">fold</a> to be <code><span class='Number'>1</span><span class='Function'>⊣</span><span class='Modifier'>´</span><span class='Function'>≢</span></code>.</p> diff --git a/docs/doc/shift.html b/docs/doc/shift.html index ecee0d5c..012dfb0d 100644 --- a/docs/doc/shift.html +++ b/docs/doc/shift.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Shift functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="shift-functions">Shift functions</h1> <p>The shift functions <code><span class='Function'>«</span></code> and <code><span class='Function'>»</span></code> add major cells to one side an array, displacing cells on the opposite side and moving those in between. Shifts resemble but are more general than the bit-based shift operations used in low-level languages. They replace the APL pattern of a 2-wise reduction after appending or prepending an element (APL's <code><span class='Number'>2</span><span class='Function'>≠/</span><span class='Number'>0</span><span class='Separator'>,</span><span class='Value'>v</span></code> translates to <code><span class='Function'>»</span><span class='Modifier2'>⊸</span><span class='Function'>≠</span><span class='Value'>v</span></code>), one of the more common uses of 2-wise reduction.</p> <p>The result of a shift function always has the same shape as <code><span class='Value'>𝕩</span></code>. The function adds major cells to the beginning (<code><span class='Function'>»</span></code>) or end (<code><span class='Function'>«</span></code>) of <code><span class='Value'>𝕩</span></code>, moving the cells already in <code><span class='Value'>𝕩</span></code> to accomodate them. Some cells on the opposite side from those added will "fall off" and not be included in the result.</p> diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html index 1eab4d0c..98e09225 100644 --- a/docs/doc/syntax.html +++ b/docs/doc/syntax.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Syntax overview</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="syntax-overview">Syntax overview</h1> <p>BQN syntax consists of expressions where computation is done with a little organizing structure around them like assignment, functions, and list notation. Expressions are where the programmer is in control so the design tries to do as much as possible with them before introducing special syntax.</p> <h2 id="special-glyphs">Special glyphs</h2> diff --git a/docs/doc/take.html b/docs/doc/take.html index 2126479d..0dcbaa39 100644 --- a/docs/doc/take.html +++ b/docs/doc/take.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Take and Drop</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="take-and-drop">Take and Drop</h1> <svg viewBox='-156.8 -64 672 204.8'> <g fill='currentColor' stroke-linecap='round' text-anchor='middle' font-family='BQN,monospace'> diff --git a/docs/doc/train.html b/docs/doc/train.html index 8800d7f5..b9c2f398 100644 --- a/docs/doc/train.html +++ b/docs/doc/train.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Function trains</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="function-trains">Function trains</h1> <p>Trains are an important aspect of BQN's <a href="tacit.html">tacit</a> programming capabilities. In fact, a crucial one: with trains and the <a href="identity.html">identity functions</a> Left (<code><span class='Function'>⊣</span></code>) and Right (<code><span class='Function'>⊢</span></code>), a fully tacit program can express any explicit function whose body is a statement with <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code> used only as arguments (that is, there are no assignments and <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code> are not used in operands or lists. Functions with assignments may have too many variables active at once to be directly translated but can be emulated by constructing lists. But it's probably a bad idea). Without trains it isn't possible to have two different functions that each use both arguments to a dyadic function. With trains it's perfectly natural.</p> <p>BQN's trains are the same as those of Dyalog APL, except that Dyalog is missing the minor convenience of BQN's Nothing (<code><span class='Nothing'>·</span></code>). There are many Dyalog-based documents and videos on trains you can view on the <a href="https://aplwiki.com/wiki/Train">APL Wiki</a>.</p> diff --git a/docs/doc/transpose.html b/docs/doc/transpose.html index e0cdf512..42d3dd71 100644 --- a/docs/doc/transpose.html +++ b/docs/doc/transpose.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Transpose</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="transpose">Transpose</h1> <p>Transpose (<code><span class='Function'>⍉</span></code>) is a tool for rearranging the axes of an array. BQN's version is tweaked relative to APL to align better with the leading axis model and make common operations easier.</p> <h2 id="transpose-basics">Transpose basics</h2> diff --git a/docs/doc/types.html b/docs/doc/types.html index 8d3c4e39..1fffb7d1 100644 --- a/docs/doc/types.html +++ b/docs/doc/types.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Types</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="types">Types</h1> <p>BQN supports the following fundamental types:</p> <ul> diff --git a/docs/doc/undo.html b/docs/doc/undo.html index 973a942a..dc3f9d37 100644 --- a/docs/doc/undo.html +++ b/docs/doc/undo.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Undo</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="undo">Undo</h1> <p>Oh no, you've deleted a function after spending half an hour writing it! Well… hopefully your editor can help with that. But maybe you'll be interested to hear that BQN can reverse the action of some functions—ones that <em>don't</em> lose information. This capability is also used by <a href="repeat.html">Repeat</a> (<code><span class='Modifier2'>⍟</span></code>) to repeat a negative number of times.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiDijL0gImFiY2RlIgoKMiDijL3igbwgMiDijL0gImFiY2RlIg==">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>⌽</span> <span class='String'>"abcde"</span> diff --git a/docs/doc/windows.html b/docs/doc/windows.html index bbfc50c3..bc2aa263 100644 --- a/docs/doc/windows.html +++ b/docs/doc/windows.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Windows</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> <h1 id="windows">Windows</h1> <p>In BQN, it's strongly preferred to use functions, and not modifiers, for array manipulation. Functions are simpler as they have fewer moving parts. They are more concrete, since the array results can always be viewed right away. They are easier to implement with reasonable performance as well, since there is no need to recognize many possible function operands as special cases.</p> <p>The Window function replaces APL's Windowed Reduction, J's more general Infix operator, and Dyalog's Stencil, which is adapted from one case of J's Cut operator.</p> diff --git a/docs/editors/index.html b/docs/editors/index.html index 8563fff6..882525c6 100644 --- a/docs/editors/index.html +++ b/docs/editors/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Editor support</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="editor-support">Editor support</h1> <style>.Comment,.Function,.Number,.String { color: inherit; }</style> <p>Editor plugins and other tools for allowing BQN input are in <a href="https://github.com/mlochbaum/BQN/tree/master/editors">this folder</a>. Input is always performed with a backslash <code><span class='Value'>\</span></code> prefix by default, using the layout shown <a href="https://mlochbaum.github.io/BQN/keymap.html">here</a>. To type an actual backslash, hit the backslash key twice.</p> diff --git a/docs/implementation/codfns.html b/docs/implementation/codfns.html index 48b1d1b9..57cfa3d5 100644 --- a/docs/implementation/codfns.html +++ b/docs/implementation/codfns.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Co-dfns versus BQN's implementation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">implementation</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">implementation</a></div> <h1 id="co-dfns-versus-bqns-implementation">Co-dfns versus BQN's implementation</h1> <p>The BQN self-hosted compiler is directly inspired by the <a href="https://github.com/Co-dfns/Co-dfns">Co-dfns</a> project, a compiler for a subset of <a href="../doc/fromDyalog.html">Dyalog APL</a>. I'm very grateful to Aaron for showing that array-oriented compilation is even possible! In addition to the obvious difference of target language, BQN differs from Co-dfns both in goals and methods.</p> <p>The shared goals of BQN and Co-dfns are to implement a compiler for an array language with whole-array operations. This provides the theoretical benefit of a short <em>critical path</em>, which in practice means that both compilers can make good use of a GPU or a CPU's vector instructions simply by providing an appropriate runtime (however, only Co-dfns has such a runtime—an ArrayFire program on the GPU and Dyalog APL on the CPU). The two implementations also share a preference for working "close to the metal" by passing around arrays of numbers rather than creating abstract types to work with data. Objects are right out. These choices lead to a compact source code implementation, and may have some benefits in terms of how easy it is to write and understand the compiler.</p> diff --git a/docs/implementation/compile/dynamic.html b/docs/implementation/compile/dynamic.html index 1d232644..1edb73ef 100644 --- a/docs/implementation/compile/dynamic.html +++ b/docs/implementation/compile/dynamic.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Dynamic compilation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a> / <a href="index.html">compile</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a> / <a href="index.html">compile</a></div> <h1 id="dynamic-compilation">Dynamic compilation</h1> <p>This page discusses at a high level (without covering any specific source transformations) how compilation and interpretation might be structured in order to execute BQN faster. Effective strategies will compile parts of the program with more specialization or higher optimization as it runs and more information about it becomes known.</p> <p>To avoid confusion, an <strong>interpreter</strong> evaluates code to perform actions or produce a result; a CPU is a machine code interpreter. A <strong>compiler</strong> transforms code in one language or format to another. To run a program that does anything, it must eventually be interpreted; before this the program or parts of it might be compiled any number of times.</p> diff --git a/docs/implementation/compile/index.html b/docs/implementation/compile/index.html index 2ee01371..4ec585f0 100644 --- a/docs/implementation/compile/index.html +++ b/docs/implementation/compile/index.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Optimizing compilation notes</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a></div> <h1 id="optimizing-compilation-notes">Optimizing compilation notes</h1> <p>Pages here discuss advanced compilation strategies for BQN, that is, steps that might take take place after compiling to bytecode or a similar intermediate representation.</p> <p>Most content here is currently speculative: C, Java, and Javascript backends are capable of compiling to native (x86, JVM, or Javascript) code in order to lower evaluation overhead but don't perform much if any analysis to improve this code. CBQN is likely to start making such optimizations in the future.</p> diff --git a/docs/implementation/index.html b/docs/implementation/index.html index 4cf1d1dc..d0b73c59 100644 --- a/docs/implementation/index.html +++ b/docs/implementation/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN implementation notes</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="bqn-implementation-notes">BQN implementation notes</h1> <p>Notes about how BQN is or could be implemented.</p> <p>This repository's BQN implementation is written mainly in BQN: the bytecode <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/c.bqn">compiler</a> is completely self-hosted, and the majority of the runtime (<a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/r0.bqn">r0</a>, <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/r1.bqn">r1</a>) is written in BQN except that it is allowed to define primitives; some preprocessing (<a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../src/pr.bqn">pr</a>) turns the primitives into identifiers.</p> diff --git a/docs/implementation/kclaims.html b/docs/implementation/kclaims.html index 667ff0fa..4d028e6c 100644 --- a/docs/implementation/kclaims.html +++ b/docs/implementation/kclaims.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN: Wild claims about K performance</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">implementation</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">implementation</a></div> <h1 id="wild-claims-about-k-performance">Wild claims about K performance</h1> <p>Sometimes I see unsourced, unclear, vaguely mystical claims about K being the fastest array language. It happens often enough that I'd like to write a long-form rebuttal to these, and a demand that the people who make these do more to justify them.</p> <p>This isn't meant to put down the K language! K is in fact the only APL-family language other than BQN that I would recommend without reservations. And there's nothing wrong with the K community as a whole. Go to <a href="https://chat.stackexchange.com/rooms/90748/the-k-tree">the k tree</a> and meet them! What I want to fight is the <em>myth</em> of K, which is carried around as much by those who used K once upon a time, and no longer have any connection to it, as by active users.</p> diff --git a/docs/implementation/primitive/index.html b/docs/implementation/primitive/index.html index 25c831c3..b5256302 100644 --- a/docs/implementation/primitive/index.html +++ b/docs/implementation/primitive/index.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Primitive implementation notes</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a></div> <h1 id="primitive-implementation-notes">Primitive implementation notes</h1> <p>Commentary on the best methods I know for implementing various primitives. Often there are many algorithms that are viable in different situations, and in these cases I try to discuss the tradeoffs.</p> <ul> diff --git a/docs/implementation/primitive/random.html b/docs/implementation/primitive/random.html index 943fd955..7f660792 100644 --- a/docs/implementation/primitive/random.html +++ b/docs/implementation/primitive/random.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Implementation of random stuff</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> <h1 id="implementation-of-random-stuff">Implementation of random stuff</h1> <p>Not a primitive, but CBQN's <code><span class='Function'>•MakeRand</span></code> initializes a random number generator that has some built-in utilities. For clarity we'll call a result of this initialization <code><span class='Value'>rand</span></code> in the text below.</p> <h2 id="random-number-generation">Random number generation</h2> diff --git a/docs/implementation/primitive/replicate.html b/docs/implementation/primitive/replicate.html index 5b9cf07b..9d539d40 100644 --- a/docs/implementation/primitive/replicate.html +++ b/docs/implementation/primitive/replicate.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Implementation of Indices and Replicate</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> <h1 id="implementation-of-indices-and-replicate">Implementation of Indices and Replicate</h1> <p>The replicate family of functions contains not just primitives but powerful tools for implementing other functionality. The most important is converting <a href="#booleans-to-indices">bits to indices</a>: AVX-512 extensions implement this natively for various index sizes, and even with no SIMD support at all there are surprisingly fast table-based algorithms for it.</p> <p><a href="#replicate">General replication</a> is more complex. Branching will slow many useful cases down considerably when using the obvious solution. However, branch-free techniques introduce overhead for larger replication amounts. Hybridizing these seems to be the only way, but it's finicky.</p> diff --git a/docs/implementation/primitive/sort.html b/docs/implementation/primitive/sort.html index 86c36738..2a417770 100644 --- a/docs/implementation/primitive/sort.html +++ b/docs/implementation/primitive/sort.html @@ -3,7 +3,7 @@ <link href="../../style.css" rel="stylesheet"/> <title>BQN: Implementation of ordering functions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../../index.html">main</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../../index.html">BQN</a> / <a href="../index.html">implementation</a> / <a href="index.html">primitive</a></div> <h1 id="implementation-of-ordering-functions">Implementation of ordering functions</h1> <p>The <a href="../../doc/order.html">ordering functions</a> are Sort (<code><span class='Function'>∧∨</span></code>), Grade (<code><span class='Function'>⍋⍒</span></code>), and Bins (<code><span class='Function'>⍋⍒</span></code>). Although these are well-studied—particularly sorting, and then binary search or "predecessor search"—there are many recent developments, as well as techniques that I have not found in the literature. The three functions are closely related but have important differences in what algorithms are viable. Sorting is a remarkably deep problem with different algorithms able to do a wide range of amazing things, and sophisticated ways to combine those. It is by no means solved. In comparison, Bins is pretty tame.</p> <p>There's a large divide between ordering compound data and simple data. For compound data comparisons are expensive, and the best algorithm will generally be the one that uses the fewest comparisons. For simple data they fall somewhere between cheap and extremely cheap, and fancy branchless and vectorized algorithms are the best.</p> diff --git a/docs/implementation/vm.html b/docs/implementation/vm.html index 109416ff..1ecac46c 100644 --- a/docs/implementation/vm.html +++ b/docs/implementation/vm.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>The BQN virtual machine and runtime</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">implementation</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">implementation</a></div> <h1 id="the-bqn-virtual-machine-and-runtime">The BQN virtual machine and runtime</h1> <p>BQN's self-hosted compiler and runtime mean that only a small amount of native code is needed to run BQN on any given platform. The <a href="https://github.com/mlochbaum/BQN/blob/master/implementation/../docs/bqn.js">Javascript environment</a> requires about 500 lines of Javascript code including system functions and performance improvements; probably around 250 would be required just to run the core language. This makes it fairly easy to port BQN to new platforms, allowing BQN to be <a href="../doc/embed.html">embedded</a> within other programming languages and interact with arrays or functions in those languages.</p> <p>The way data is represented is part of the VM implementation: it can use native arrays or a custom data structure, depending on what the language supports. An initial implementation will be very slow, but can be improved by replacing functions from the BQN-based runtime with native code. As the VM system can be hard to work with if you're not familiar with it, I advise you to contact me to discuss implementing a VM if you are interested.</p> diff --git a/docs/index.html b/docs/index.html index e151c435..13f8df4b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ <link href="style.css" rel="stylesheet"/> <title>BQN: finally, an APL for your flying saucer</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>)</div> <h1 id="bqn-finally-an-apl-for-your-flying-saucer">BQN: finally, an APL for your flying saucer</h1> <center> diff --git a/docs/running.html b/docs/running.html index a87627a4..c69ec64d 100644 --- a/docs/running.html +++ b/docs/running.html @@ -3,7 +3,7 @@ <link href="style.css" rel="stylesheet"/> <title>How to run BQN</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="index.html">BQN</a></div> <h1 id="how-to-run-bqn">How to run BQN</h1> <p>We are currently working quickly to make <a href="https://github.com/dzaima/CBQN">CBQN</a> into the definitive offline implementation. Compilation speed (self-hosted) is good, the only significant core language feature missing is block headers and multiple bodies, and the essential system functions are there. Unless you need to start heavy number crunching right away, I recommend that you use CBQN and make system function or performance requests on Github or the BQN forums.</p> <p>A lot of development to date has been done in dzaima/BQN and uses features (mainly headers) that aren't in CBQN yet. Scripts in this repository use <code><span class='Value'>bqn</span></code> in the <code><span class='Comment'>#!</span></code> line if self-hosted or dzaima/BQN can run them, and <code><span class='Value'>dbqn</span></code> if only dzaima/BQN works.</p> diff --git a/docs/spec/evaluate.html b/docs/spec/evaluate.html index 93558c07..044f534c 100644 --- a/docs/spec/evaluate.html +++ b/docs/spec/evaluate.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN evaluation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-evaluation">Specification: BQN evaluation</h1> <p>This page describes the semantics of the code constructs whose grammar is given in <a href="grammar.html">grammar.md</a>. The formation rules there are not named, and here they are identified by either the name of the term or by copying the rule entirely if there are several alternative productions.</p> <p>Here we assume that the referent of each identifier, or equivalently the connections between identifiers, have been identified according to the <a href="scope.html">scoping rules</a>.</p> diff --git a/docs/spec/grammar.html b/docs/spec/grammar.html index 419eb406..3ad5bd25 100644 --- a/docs/spec/grammar.html +++ b/docs/spec/grammar.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN grammar</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-grammar">Specification: BQN grammar</h1> <p>BQN's grammar is given below. Terms are defined in a <a href="https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form">BNF</a> variant. However, handling special names properly is possible but difficult in BNF, so they are explained in text along with the braced block grammar.</p> <p>The symbols <code><span class='Value'>s</span></code>, <code><span class='Function'>F</span></code>, <code><span class='Modifier'>_m</span></code>, and <code><span class='Modifier2'>_c_</span></code> are identifier tokens with subject, function, 1-modifier, and 2-modifier classes respectively. Similarly, <code><span class='Value'>sl</span></code>, <code><span class='Function'>Fl</span></code>, <code><span class='Modifier'>_ml</span></code>, and <code><span class='Modifier2'>_cl_</span></code> refer to literals and primitives of those classes. While names in the BNF here follow the identifier naming scheme, this is informative only: syntactic roles are no longer used after parsing and cannot be inspected in a running program.</p> diff --git a/docs/spec/index.html b/docs/spec/index.html index f0f78231..b8f1d80e 100644 --- a/docs/spec/index.html +++ b/docs/spec/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN specification</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="bqn-specification">BQN specification</h1> <p>This document, and the others in this directory (linked in the list below) make up the pre-versioning BQN specification. The specification differs from the <a href="../doc/index.html">documentation</a> in that its purpose is only to describe the exact details of BQN's operation in the most quickly accessible way, rather than to explain the central ideas of BQN functionality and how it might be used. The core of BQN, which excludes system-provided values, is now almost completely specified. One planned feature—an extension to allow low-rank elements in the argument to Join—has not yet been added, and the spec will continue to be edited further to improve clarity and cover any edge cases that have been missed.</p> <p>Under this specification, a language implementation is a <strong>BQN pre-version implementation</strong> if it behaves as specified for all input programs. It is a <strong>BQN pre-version implementation with extensions</strong> if it behaves as specified in all cases where the specification does not require an error, but behaves differently in at least one case where it requires an error. It is a <strong>partial</strong> version of either of these if it doesn't conform to the description but differs from a conforming implementation only by rejecting with an error some programs that the conforming implementation accepts. As the specification is not yet versioned, other instances of the specification define these terms in different ways. An implementation can use one of these terms if it conforms to any instance of the pre-versioning BQN specifications that defines them. When versioning is begun, there will be only one specification for each version.</p> diff --git a/docs/spec/inferred.html b/docs/spec/inferred.html index 433a65c5..c25ad29c 100644 --- a/docs/spec/inferred.html +++ b/docs/spec/inferred.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN inferred properties</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-inferred-properties">Specification: BQN inferred properties</h1> <p>BQN includes some simple deductive capabilities: detecting the type of empty array elements, the result of an empty reduction, and the Undo (<code><span class='Modifier'>⁼</span></code>) and Under (<code><span class='Modifier2'>⌾</span></code>) modifiers. These tasks are a kind of proof-based or constraint programming, and can never be solved completely (some instances will be undecidable) but can be solved in more instances by ever-more sophisticated algorithms. To allow implementers to develop more advanced implementations while offering some stability and portability to programmers, two kinds of specification are given here. First, constraints are given on the behavior of inferred properties. These are not exact and require some judgment on the part of the implementer. Second, behavior for common or useful cases is specified more precisely. Non-normative suggestions are also given as a reference for implementers.</p> <p>For the specified cases, the given functions and modifiers refer to those particular representations. It is not necessary to detect equivalent representations, for example to reduce <code><span class='Paren'>(</span><span class='Function'>+-×</span><span class='Paren'>)</span><span class='Modifier'>⁼</span></code> to <code><span class='Function'>∨</span><span class='Modifier'>⁼</span></code>. However, it is necessary to identify computed functions and modifiers: for example <code><span class='Function'>F</span><span class='Modifier'>⁼</span></code> when the value of <code><span class='Function'>F</span></code> in the expression is <code><span class='Function'>∨</span></code>, or <code><span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>⊑∧</span><span class='Ligature'>‿</span><span class='Function'>∨</span><span class='Paren'>)</span><span class='Modifier'>⁼</span></code>.</p> diff --git a/docs/spec/literal.html b/docs/spec/literal.html index 47696b37..3b2b248a 100644 --- a/docs/spec/literal.html +++ b/docs/spec/literal.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN literal notation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-literal-notation">Specification: BQN literal notation</h1> <p>A <em>literal</em> is a single <a href="token.html">token</a> that indicates a fixed character, number, or array. While literals indicate values of a data type, <a href="primitive.html">primitives</a> indicate values of an operation type: function, 1-modifier, or 2-modifier.</p> <p>Two types of literal deal with text. As the source code is considered to be a sequence of unicode code points ("characters"), and these code points are also used for BQN's character <a href="types.html">data type</a>, the representation of a text literal is very similar to its value. In a text literal, the newline character is always represented using the ASCII line feed character, code point 10. A <em>character literal</em> is enclosed with single quotes <code><span class='String'>'</span></code> and its value is identical to the single character between them. A <em>string literal</em> is enclosed in double quotes <code><span class='String'>"</span></code>, and any double quotes between them must come in pairs, as a lone double quote marks the end of the literal. The value of a string literal is a rank-1 array whose elements are the characters in between the enclosing quotes, after replacing each pair of double quotes with only one such quote. The <em>null literal</em> is the token <code><span class='String'>@</span></code> and represents the null character, code point 0.</p> diff --git a/docs/spec/primitive.html b/docs/spec/primitive.html index b2e127c6..c3f4ab2f 100644 --- a/docs/spec/primitive.html +++ b/docs/spec/primitive.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN primitives</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-primitives">Specification: BQN primitives</h1> <p>Most primitives are specified by the BQN-based implementation in <a href="https://github.com/mlochbaum/BQN/blob/master/spec/reference.bqn">reference.bqn</a>. This document specifies the basic functionality required by those definitions. Descriptions of other primitives are for informational purposes only.</p> <h2 id="pervasive-primitives">Pervasive primitives</h2> diff --git a/docs/spec/scope.html b/docs/spec/scope.html index 8ab3fd91..be592157 100644 --- a/docs/spec/scope.html +++ b/docs/spec/scope.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN variable scoping</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-variable-scoping">Specification: BQN variable scoping</h1> <p>BQN uses lexical scoping for variables, where scopes correspond roughly to blocks, or pairs of curly braces separated by semicolons. At the top level in a scope, new variables are visible only after they are defined, but in the scopes it contains, all variables defined in that scope are visible. This system is specified more precisely below.</p> <p>A running BQN program manipulates variables during its <a href="evaluate.html">execution</a>, but it is important to distinguish these variables from the identifiers that refer to them. As defined in the <a href="token.html">tokenization rules</a>, an identifier is a particular kind of token found in a program's source code. The lexical scoping rules in this page define which identifiers are considered the same; these identifiers will refer to the same variables when the program is run. While each variable has only one identifier, an identifier can refer to any number of variables because a new variable is created for that identifier each time its containing scope is instantiated (that is, each time the contents of the block are evaluated).</p> diff --git a/docs/spec/system.html b/docs/spec/system.html index 6cf5bcc9..53cde76c 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN system-provided values</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-system-provided-values">Specification: BQN system-provided values</h1> <p>This portion of the spec is still potentially subject to major changes.</p> <p>The <code><span class='Value'>•</span></code> symbol is used to access values other than primitives provided by BQN.</p> diff --git a/docs/spec/token.html b/docs/spec/token.html index 8eb4bcee..e2b851a3 100644 --- a/docs/spec/token.html +++ b/docs/spec/token.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN token formation</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-token-formation">Specification: BQN token formation</h1> <p>This page describes BQN's token formation rules (token formation is also called scanning). Most tokens in BQN are a single character long, but quoted characters and strings, identifiers, and numbers can consist of multiple characters, and comments, spaces, and tabs are discarded during token formation.</p> <p>BQN source code should be considered as a series of unicode code points, which we refer to as "characters". The separator between lines in a file is considered to be a single character, newline, even though some operating systems such as Windows typically represent it with a two-character CRLF sequence. Implementers should note that not all languages treat unicode code points as atomic, as exposing the UTF-8 or UTF-16 representation instead is common. For a language such as JavaScript that uses UTF-16, the double-struck characters <code><span class='Value'>𝕨</span><span class='Function'>𝕎</span><span class='Value'>𝕩</span><span class='Function'>𝕏</span><span class='Value'>𝕗</span><span class='Function'>𝔽</span><span class='Value'>𝕘</span><span class='Function'>𝔾</span></code> are represented as two 16-bit surrogate characters, but BQN treats them as a single unit.</p> diff --git a/docs/spec/types.html b/docs/spec/types.html index 74110a74..ea44bb76 100644 --- a/docs/spec/types.html +++ b/docs/spec/types.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Specification: BQN types</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">spec</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">spec</a></div> <h1 id="specification-bqn-types">Specification: BQN types</h1> <p>BQN programs manipulate data of seven types:</p> <ul> diff --git a/docs/tutorial/combinator.html b/docs/tutorial/combinator.html index 0a8faf29..5052aad1 100644 --- a/docs/tutorial/combinator.html +++ b/docs/tutorial/combinator.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN Tutorial: Combinators</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">tutorial</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">tutorial</a></div> <h1 id="tutorial-combinators">Tutorial: Combinators</h1> <p>BQN has a normal enough curly-brace syntax for functions and so on. I don't want to talk about it just yet. Before you get to thinking about how to write <a href="http://www.pbm.com/~lindahl/real.programmers.html">FORTRAN in any language</a> in BQN, let's see if we can acquire some instincts about idiomatic BQN the way that only being stuck in a tightly restricted and horribly confining programming environment can accomplish.</p> <p>There are benefits to being tightly restricted and horribly confined! In programming. I don't just mean that it forces you to learn new techniques like I said, I mean that using the restricted style we will learn is actually a better way to write portions of a program. This is because a restriction you apply in one part of a program is a promise you can rely on in the rest of the program. So what are we giving up, and what can we rely on in return?</p> diff --git a/docs/tutorial/expression.html b/docs/tutorial/expression.html index eb039362..840ec4fd 100644 --- a/docs/tutorial/expression.html +++ b/docs/tutorial/expression.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>Tutorial: BQN expressions</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">tutorial</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">tutorial</a></div> <h1 id="tutorial-bqn-expressions">Tutorial: BQN expressions</h1> <h2 id="arithmetic">Arithmetic</h2> <p>All right, let's get started! Since you can run BQN online from the <a href="https://mlochbaum.github.io/BQN/try.html">REPL</a> there aren't any real technical preliminaries, but if you'd like to look at non-web-based options head over to <a href="../running.html">running.md</a>.</p> diff --git a/docs/tutorial/index.html b/docs/tutorial/index.html index 06a0ec5c..396aabe4 100644 --- a/docs/tutorial/index.html +++ b/docs/tutorial/index.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN tutorials</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a></div> <h1 id="bqn-tutorials">BQN tutorials</h1> <p>BQN tutorials explain how to approach and use the language as a newcomer (or they try; please get in touch if you find that they skip ahead!). Tutorials are meant to explain key ideas and may ignore details that would be included in the <a href="../doc/index.html">documentation</a>; also unlike the documentation they're meant to be read in order, as each tutorial will build on ideas from the previous ones.</p> <p>Tutorials assume (pretty presumptively, really. Disgusting.) that you are already motivated to learn BQN and use simple rather than flashy examples. Documents to induce motivation beyond the README are not yet available. Do feel free to skim or jump around if you find you are reading a lot of things that are already obvious.</p> diff --git a/docs/tutorial/list.html b/docs/tutorial/list.html index 07846387..a44c30b4 100644 --- a/docs/tutorial/list.html +++ b/docs/tutorial/list.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN Tutorial: Working with lists</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">tutorial</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">tutorial</a></div> <h1 id="tutorial-working-with-lists">Tutorial: Working with lists</h1> <p>Enough with all these preliminaries like learning how to read basic expressions. Let's get into what makes BQN special.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oMSwgMiwgM+KfqQ==">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Number'>1</span><span class='Separator'>,</span> <span class='Number'>2</span><span class='Separator'>,</span> <span class='Number'>3</span><span class='Bracket'>⟩</span> diff --git a/docs/tutorial/variable.html b/docs/tutorial/variable.html index 4db40728..33f1e48c 100644 --- a/docs/tutorial/variable.html +++ b/docs/tutorial/variable.html @@ -3,7 +3,7 @@ <link href="../style.css" rel="stylesheet"/> <title>BQN Tutorial: Variables</title> </head> -<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">tutorial</a></div> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">tutorial</a></div> <h1 id="tutorial-variables">Tutorial: Variables</h1> <p>To take a proud denizen of the eternal cosmos of values, held for a fleeting instant by the course of code, and bind it. Tie it down with a name, failing always to alter its inner nature but allowing context to reform its outer appearance. So labelled, perhaps through the progress of time it will know escape, or else find itself passed through one bond to another, ever tethered. It's a task to be approached only with respect.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aGV5IOKGkCAiSGkgdGhlcmUiCgpoZXkg4oi+ICIsIFdvcmxkISI=">↗️</a><pre> <span class='Value'>hey</span> <span class='Gets'>←</span> <span class='String'>"Hi there"</span> @@ -653,8 +653,8 @@ ConvertFile ← { "stylesheet" Link "style.css" "title" Html ("BQN"∾":"⊸(¬∘∊/⊣)∾" "∾⊢)⍟(¬·∨´"BQN"⍷⊢) 2↓⊑h1 ⟩ - repo ← "a href='"‿repoURL‿"'" ∾⊸Html "BQN" - crumbs ← up ("a href='"∾∾⟜"index.html'")⊸Html¨○((-isInd)⊸↓) (<"main")»parts + repo ← "("∾")"∾˜ "a href='"‿repoURL‿"'" ∾⊸Html "github" + crumbs ← up ("a href='"∾∾⟜"index.html'")⊸Html¨○((-isInd)⊸↓) (<"BQN")»parts nav ← RQ "div class='nav'" Html 3↓∾ " / "⊸∾¨ repo <⊸∾ crumbs front ← head ∾○(∾⟜lf) nav ("docs/"∾fileout) •FChars front ∾ out |
