From 65eef4fade5eb426dae01d480f383b8a30b23071 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 11 Aug 2021 14:06:02 -0400 Subject: Change "BQN / main" in header to "(github) / BQN" --- docs/doc/arithmetic.html | 2 +- docs/doc/array.html | 2 +- docs/doc/arrayrepr.html | 2 +- docs/doc/assert.html | 2 +- docs/doc/based.html | 2 +- docs/doc/block.html | 2 +- docs/doc/context.html | 2 +- docs/doc/control.html | 2 +- docs/doc/couple.html | 2 +- docs/doc/depth.html | 2 +- docs/doc/embed.html | 2 +- docs/doc/enclose.html | 2 +- docs/doc/expression.html | 2 +- docs/doc/fill.html | 2 +- docs/doc/find.html | 2 +- docs/doc/fold.html | 2 +- docs/doc/fromDyalog.html | 2 +- docs/doc/fromJ.html | 2 +- docs/doc/functional.html | 2 +- docs/doc/glossary.html | 2 +- docs/doc/group.html | 2 +- docs/doc/identity.html | 2 +- docs/doc/index.html | 2 +- docs/doc/indices.html | 2 +- docs/doc/join.html | 2 +- docs/doc/leading.html | 2 +- docs/doc/lexical.html | 2 +- docs/doc/logic.html | 2 +- docs/doc/map.html | 2 +- docs/doc/match.html | 2 +- docs/doc/namespace.html | 2 +- docs/doc/oop.html | 2 +- docs/doc/order.html | 2 +- docs/doc/paradigms.html | 2 +- docs/doc/pick.html | 2 +- docs/doc/prefixes.html | 2 +- docs/doc/primitive.html | 2 +- docs/doc/range.html | 2 +- docs/doc/repeat.html | 2 +- docs/doc/replicate.html | 2 +- docs/doc/reshape.html | 2 +- docs/doc/reverse.html | 2 +- docs/doc/scan.html | 2 +- docs/doc/search.html | 2 +- docs/doc/select.html | 2 +- docs/doc/selfcmp.html | 2 +- docs/doc/shape.html | 2 +- docs/doc/shift.html | 2 +- docs/doc/syntax.html | 2 +- docs/doc/take.html | 2 +- docs/doc/train.html | 2 +- docs/doc/transpose.html | 2 +- docs/doc/types.html | 2 +- docs/doc/undo.html | 2 +- docs/doc/windows.html | 2 +- 55 files changed, 55 insertions(+), 55 deletions(-) (limited to 'docs/doc') 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 @@ BQN: Arithmetic functions - +

Arithmetic functions

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.

Summary of differences for APLers:

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 @@ BQN: The array - +

The array

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 held to be tricky; here we'll see definitions, examples, and metaphors.

In BQN, as in APL, arrays are multidimensional, instead of strictly linear. Languages like Python, Javascript, or Haskell offer only one-dimensional arrays with [] syntax, and typically represent multidimensional data with nested arrays. Multidimensional arrays have fundamental differences relative to this model.

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 @@ BQN: Array notation and display - +

Array notation and display

This page documents ways arrays are represented in BQN: the notation you can use to write them and the way the REPL displays them.

Array display is a feature of a BQN environment such as a REPL. You can also access it with •Fmt, 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 •Repr.

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 @@ BQN: Assert - +

Assert

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 (), 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 !. This function checks whether 𝕩 matches 1: if it does, then it does nothing and returns 𝕩, and otherwise it gives an error.

↗️
    ! 2=2  # 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 @@
   
   BQN: Based array theory
 
-
+
 

Based array theory

"Like a normal programming language"

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 @@ BQN: Blocks - +

Blocks

In BQN, a block is any piece of code surrounded with curly braces {}. 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.

Blocks are most commonly used to define functions by including one of the special names for arguments, 𝕨 or 𝕩. With the operands 𝔽 or 𝔾, they can also define 1-modifiers or 2-modifiers.

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 @@ BQN's context-free grammar - +

BQN's context-free grammar

APL has a problem. To illustrate, let's look at an APL expression:

a b c d e
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 @@
   
   Control flow in BQN
 
-
+
 

Control flow in BQN

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.

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.

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 @@ BQN: Couple and Merge - +

Couple and Merge

Solo/Couple () and Merge (>) 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 23:

↗️
     p  35×3
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 @@
   
   BQN: Depth
 
-
+
 

Depth

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 @@ Using embedded BQN - +

Using embedded BQN

The Javascript implementation of BQN, docs/bqn.js, can be used 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.

There is only one mechanism to interface between the host language and BQN: the function bqn 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!

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 @@ BQN: Enclose - +

Enclose

The function enclose creates a unit array whose only element is 𝕩.

↗️
    < "xyz"
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 @@
   
   BQN: Expression syntax
 
-
+
 

Expression syntax

BQN expressions are the part of syntax that describes computations to perform. Programs are mainly made up of expressions with a little organizing material like blocks and namespaces around them. This page explains how functions, modifiers, and assignment combine with their inputs. It doesn't describe constant and array literals, which each form a single subject for grammatical purposes.

The first tutorial also covers how to build and read BQN expressions.

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 @@ BQN: Fill elements - +

Fill elements

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 0 or ' '. If no fill is known, a function that requests it results in an error.

Fills are used by Take () when a value in 𝕨 is larger than the corresponding length in 𝕩, by the two Nudge functions (»«) when 𝕩 is non-empty, by Merge (>) when 𝕩 is empty, and by Reshape () when 𝕨 contains . Except for these specific cases, the fill value an array has can't affect the program. The result of Match () doesn't depend on fills, and any attempt to compute a fill can't cause side effects.

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 @@ BQN: Find - +

Find

Find () searches for occurrences of an array 𝕨 within 𝕩. The result contains a boolean for each possible location, which is 1 if 𝕨 was found there and 0 if not.

↗️
    "xx"  "xxbdxxxcx"
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 @@
   
   BQN: Fold and Insert
 
-
+
 

Fold and Insert

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 @@ BQN–Dyalog APL dictionary - +

BQN–Dyalog APL dictionary

A few tables to help users of Dyalog APL (or similar) get started quickly on BQN. Here we assume ML is 1 for Dyalog.

Terminology

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 @@ BQN–J dictionary - +

BQN–J dictionary

A guide to help users of J get up to speed with BQN quickly.

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 @@ BQN: Functional programming - +

Functional programming

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?

First, let's be clear about what the terms we're using mean. A language has first-class functions 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.

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 @@ BQN glossary - +

BQN glossary

Below are short, and sometimes vague, definitions of terms used to describe BQN code.

Types

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 @@ BQN: Group - +

Group

BQN replaces the Key operator from J or Dyalog APL, and many forms of partitioning, with a single (ambivalent) Group function . This function is somewhat related to the K function = of the same name, but results in an array rather than a dictionary.

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 @@ BQN: Identity functions - +

Identity functions

Here are the simplest functions in BQN: Right () always returns its right argument, and Left () returns its left argument if called with two arguments, and the right argument otherwise.

↗️
     "only"
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 @@
   
   BQN documentation
 
-
+
 

BQN documentation

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 tutorials. While the core language specification is complete, the documentation still has minor gaps.

Overview:

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 @@ BQN: Indices - +

Indices

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 multidimensional arrays using the leading axis theory, 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: Range (), which returns an array of them if given a list argument, and Pick (), where the depth-1 components of an array left argument are list indices.

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. Group () 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.

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 @@ BQN: Join and Join To - +

Join and Join To

The glyph 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 the functions that combine arrays along a new axis, Merge (>) and Couple ().

Join To

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 @@ BQN: The leading axis convention - +

The leading axis convention

Several primitive functions manipulate the right argument, or sometimes both arguments, of an array along one or more axes. According to the leading axis model, 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.

Monadic functions

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 @@ BQN: Lexical scoping - +

Lexical scoping

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.

In short, every block 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.

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 @@ BQN Logic functions: And, Or, Not (also Span) - +

Logic functions: And, Or, Not (also Span)

BQN retains the APL symbols and for logical and and or, and changed APL's ~ to ¬ for not, since ~ looks too much like ˜ and ¬ is more common in mathematics today. Like J, BQN extends Not to the linear function 1-. However, it discards GCD and LCM as extensions of And and Or, and instead uses bilinear extensions: And is identical to Times (×), while Or is ׬, following De Morgan's laws (other ways of obtaining a function for Or give an equivalent result—there is only one bilinear extension).

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 A occurs with probability a and B with probability b independent of A, then A or B occurs with probability ab). 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.

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 @@ BQN: Mapping modifiers - +

Mapping modifiers

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.

BQN has two 1-modifiers to map over arrays: Each (¨) and Table (). 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 (˘) or its generalization Rank (), which apply the function to array cells. The modifier Depth () is a generalization of Each, so that ¨ is ¯1; however, it can't be used to implement Table without some additional array operations.

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 @@ BQN: Match - +

Match

The primitive Match () tests whether its two argument arrays are considered equivalent in BQN, returning 1 if so and 0 otherwise. Not Match () is the opposite, returning 1 if the two arrays aren't equivalent and 0 if they are.

↗️
    "abc"  'a''b''c'
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 @@
   
   BQN: Namespaces
 
-
+
 

Namespaces

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 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 to change the value of a field.

The following quick example shows a few ways to use a namespace returned by •Import:

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 @@ Object-oriented programming in BQN - +

Object-oriented programming in BQN

BQN's namespaces can be used to support a simple form of object-oriented programming (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:

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 @@ BQN: Ordering functions - +

Ordering functions

BQN has six functions that order arrays as part of their operation (the comparison functions ≤<>≥ 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.

    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 @@ BQN in programming paradigms - +

    BQN in programming paradigms

    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.

    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.

    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 @@ BQN: Pick - +

    Pick

    Pick () chooses elements from 𝕩 based on index lists from 𝕨. 𝕨 can be a plain list, or even one number if 𝕩 is a list, in order to get one element from 𝕩. It can also be an array of index lists, or have deeper array structure: each index list will be replaced with the element of 𝕩 at that index, effectively applying to 𝕨 at depth 1.

    With no 𝕨, monadic 𝕩 takes the first element of 𝕩 in index order, with an error if 𝕩 is empty.

    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 @@ BQN: Prefixes and Suffixes - +

    Prefixes and Suffixes

    The Prefixes () function gives a list of all prefixes of its argument array along the first axis, and Suffixes () 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.

    ↗️
         "abcde"
    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 @@
       
       BQN primitives
     
    -
    +
     

    BQN primitives

    Primitives are the basic functions and modifiers built into the language, written with individual glyphs (more about the concept here). 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).

    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.

    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 @@ BQN: Range - +

    Range

    Range () is a monadic function that creates arrays of indices (like APL's famous iota function). Each element in the result is its own index.

    ↗️
         6
    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 @@
       
       BQN: The Repeat modifier
     
    -
    +
     

    The Repeat modifier

    Repeat () is a 2-modifier that applies its operand function 𝔽 multiple times.

    ↗️
        »»» "ABCDE"
    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 @@
       
       BQN: Indices and Replicate
     
    -
    +
     

    Indices and Replicate

    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 @@ BQN: Deshape and Reshape - +

    Deshape and Reshape

    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 @@ BQN: Reverse and Rotate - +

    Reverse and Rotate

    The symbol 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 shape and all the same elements as 𝕩, possibly in a different arrangement. And elements that start out next to each other in 𝕩 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 isometries preserving a discrete subgroup of the torus, if one were inclined to think such things. On major cells, the two functions decompose the dihedral group okay I'll stop.

    Many uses of Rotate in APL are better handled by shift functions in BQN. If there's no reason to treat the data as cyclic or periodic, it's best to avoid Rotate.

    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 @@ BQN: Scan - +

    Scan

    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 @@ BQN: Search functions - +

    Search functions

    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 @@ BQN: Select - +

    Select

    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 @@ BQN: Self-search functions - +

    Self-search functions

    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 @@ BQN: Array dimensions - +

    Array dimensions

    The function Shape () returns an array's shape, and Rank (=) and Length () 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.

    Rank can be defined as while Length can be defined with a fold to be 1´.

    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 @@ BQN: Shift functions - +

    Shift functions

    The shift functions « and » 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 2≠/0,v translates to »v), one of the more common uses of 2-wise reduction.

    The result of a shift function always has the same shape as 𝕩. The function adds major cells to the beginning (») or end («) of 𝕩, moving the cells already in 𝕩 to accomodate them. Some cells on the opposite side from those added will "fall off" and not be included in the result.

    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 @@ BQN: Syntax overview - +

    Syntax overview

    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.

    Special glyphs

    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 @@ BQN: Take and Drop - +

    Take and Drop

    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 @@ BQN: Function trains - +

    Function trains

    Trains are an important aspect of BQN's tacit programming capabilities. In fact, a crucial one: with trains and the identity functions Left () and Right (), a fully tacit program can express any explicit function whose body is a statement with 𝕨 and 𝕩 used only as arguments (that is, there are no assignments and 𝕨 and 𝕩 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.

    BQN's trains are the same as those of Dyalog APL, except that Dyalog is missing the minor convenience of BQN's Nothing (·). There are many Dyalog-based documents and videos on trains you can view on the APL Wiki.

    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 @@ BQN: Transpose - +

    Transpose

    Transpose () 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.

    Transpose basics

    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 @@ BQN: Types - +

    Types

    BQN supports the following fundamental types:

      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 @@ BQN: Undo - +

      Undo

      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 don't lose information. This capability is also used by Repeat () to repeat a negative number of times.

      ↗️
          2  "abcde"
      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 @@
         
         BQN: Windows
       
      -
      +
       

      Windows

      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.

      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.

      -- cgit v1.2.3