From e8d6aa976783bcb7cb5855880ff056a023f12471 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sat, 12 Jun 2021 22:26:00 -0400 Subject: Update some documentation to account for namespaces --- docs/doc/match.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/doc/match.html') diff --git a/docs/doc/match.html b/docs/doc/match.html index 57b239ee..41c2a45e 100644 --- a/docs/doc/match.html +++ b/docs/doc/match.html @@ -25,7 +25,7 @@

Match compares arrays based on their fundamental properties—shape and elements—and not the fill element, which is an inferred property. Since it can be computed differently in different implementations, using the fill element in Match could lead to some confusing results. Even if the implementation doesn't define a fill for 'a''b''c', it should still be considered to match "abc".

To give a precise definition, two arrays are considered to match if they have the same shape and all corresponding elements from the two arrays match. Every array has a finite depth so this recursive definition always ends up comparing non-arrays, or atoms. An array never matches an atom, so the result if only one argument is an atom is 0. The interesting case is when both arguments are atoms, discussed below.

Atomic equality

-

Atoms in BQN have five possible types: number, character, function, 1-modifier, and 2-modifier. Equality is not allowed to fail for any two arguments, so it needs to be defined on all of these types.

+

Atoms in BQN have six possible types: number, character, function, 1-modifier, 2-modifier, and namespace. Equality is not allowed to fail for any two arguments, so it needs to be defined on all of these types.

Starting with the easiest rules, values with different types are never equal to each other.

↗️
    'a', +, 3 = -», '+', 3˙
 ⟨ 0 0 0 ⟩
@@ -36,11 +36,11 @@
     1.25 = 1 + 0.25
 1
 
-

Operations are more difficult. Here there are three cases:

+

Mutable types are more difficult. Here there are three cases:

The first two are fairly similar to how numbers and arrays work. Primitives and compounds like trains, or modifiers with bound operands, are immutable, so they are defined purely by what components they contain.

↗️
    +,-,× = +,-,÷
-- 
cgit v1.2.3