From 2afb23928e1984d475cc460e1672e8f6fa0e4dbe Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 11 Aug 2021 17:21:31 -0400 Subject: Allow clicking on header to get fragment link --- docs/tutorial/list.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/tutorial/list.html') diff --git a/docs/tutorial/list.html b/docs/tutorial/list.html index a44c30b4..0e032b98 100644 --- a/docs/tutorial/list.html +++ b/docs/tutorial/list.html @@ -4,7 +4,7 @@ BQN Tutorial: Working with lists -

Tutorial: Working with lists

+

Tutorial: Working with lists

Enough with all these preliminaries like learning how to read basic expressions. Let's get into what makes BQN special.

↗️
    1, 2, 3
 ⟨ 1 2 3 ⟩
@@ -14,7 +14,7 @@
 ⟨ 2 3 4 ⟩
 

There we go. Now in BQN arrays are not just lists, which are a 1-dimensional data structure, but can have any number of dimensions. In this tutorial we're going to discuss lists only, leaving the 5-dimensional stuff for later. So we're really only seeing the power of K, an APL-family language that only uses lists (and dictionaries, which BQN doesn't have). K was powerful enough for Arthur Whitney to found two companies and make millions and millions of dollars, and BQN's compiler also runs almost entirely on lists, so this is probably enough power for one webpage.

-

List notation

+

List notation

There are three kinds of list notation in BQN. Each of them has a subject role overall, even if expressions used inside it might have other roles. First, a string is a list of characters, and is written by placing those characters in double quotes.

"Text!"
 
@@ -86,7 +86,7 @@ 0(12) ⟨ 0 ⟨ 1 2 ⟩ ⟩ -

BQN types

+

BQN types

Now that all six BQN types have been introduced, let's make a table:

@@ -111,7 +111,7 @@

Lists are just one-dimensional arrays. Types are divided into data types, which tend to have a subject role, and operation types, which tend to have a role matching their type. Also, any value that's not an array, such as everything we used in the last tutorial, is called an atom.

-

Arithmetic on lists

+

Arithmetic on lists

Arithmetic functions automatically apply to each element of a list argument. If both arguments are lists, they have to have the same length, and they're matched up one element at a time.

↗️
    ÷ 2,3,4
 ⟨ 0.5 0.3333333333333333 0.25 ⟩
@@ -132,7 +132,7 @@
      10, 2030  +  12, 3 
 ⟨ ⟨ 11 12 ⟩ ⟨ 23 33 ⟩ ⟩
 
-

Some list functions

+

Some list functions

@@ -183,7 +183,7 @@ ¯1"bcdea" "abcde" -

…and modifiers

+

…and modifiers

@@ -235,7 +235,7 @@ ↗️
      "con", "cat", "enat", "e" 
 "concatenate"
 
-

Example: base decoding

+

Example: base decoding

Some people like to imagine that robots or other techno-beings speak entirely in binary-encoded ASCII, like for instance "01001110 01100101 01110010 01100100 00100001". This is dumb for a lot of reasons, and the encoded text probably just says something inane, but you're a slave to curiosity and can't ignore it. Are one and a half tutorials of BQN enough to clear your conscience?

¨
@@ -359,7 +359,7 @@ ERROR +(+˜)´"1001"-'0' 9 -

Summary

+

Summary

There are three types of syntax that create lists: the "string literal" for lists of characters and either enclosing angle brackets ⟨⟩ with , or or newline characters or connecting ligatures for lists with arbitrary elements. The ligature has a higher precedence than functions or modifiers, so we should add it to our precedence table:

-- cgit v1.2.3