From db6239e74f13f6335c9c77e7a5dfa7461017f3ec Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 26 Oct 2020 13:17:02 -0400 Subject: =?UTF-8?q?Format=20empty=20arrays=20using=20=E2=86=95,=20not=20?= =?UTF-8?q?=E2=A5=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/doc/prefixes.html | 160 ++++++++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 80 deletions(-) (limited to 'docs/doc/prefixes.html') diff --git a/docs/doc/prefixes.html b/docs/doc/prefixes.html index 21bbeff7..5f951c07 100644 --- a/docs/doc/prefixes.html +++ b/docs/doc/prefixes.html @@ -99,46 +99,46 @@

We might view a slice as a selection for not two but three parameters: the number of cells before, in, and after the slice. The conditions are that each parameter, being a length, is at least 0, and the total of the three parameters is equal to the array length. With three parameters and one equality constraint, the space of slices is two-dimensional; the above ways to enumerate it each pick two parameters and allow the third to be dependent on these two. If you're familiar with barycentric coordinates on a triangle, this should sound very familiar because that's exactly what the three parameters are!

We might also consider the question of slices along multiple axes. Because axes are orthogonal, we can choose such a slice by independently slicing along each axis. To use the homogeneous shape of arrays as much as possible, the result should still only have two added layers of nesting for the two coordinates we choose, with all possible choices for the first axis along the axes of the outer array and those for the second along the axes of each inner array. Our Windows-based solution adapts to multidimensional arrays easily:

↗️
    ((1+≢)<2¨<) 32"abcdef"
-┌─                                           
-╵ ┌─           ┌─                ┌─          
-  ╵ ┌┐ ┌┐ ┌┐   ╵ 0‿1⥊⟨⟩ 0‿1⥊⟨⟩   ╵ 0‿2⥊⟨⟩    
-    └┘ └┘ └┘     0‿1⥊⟨⟩ 0‿1⥊⟨⟩     0‿2⥊⟨⟩    
-    ┌┐ ┌┐ ┌┐     0‿1⥊⟨⟩ 0‿1⥊⟨⟩     0‿2⥊⟨⟩    
-    └┘ └┘ └┘     0‿1⥊⟨⟩ 0‿1⥊⟨⟩     0‿2⥊⟨⟩    
-    ┌┐ ┌┐ ┌┐                   ┘          ┘  
-    └┘ └┘ └┘                                 
-    ┌┐ ┌┐ ┌┐                                 
-    └┘ └┘ └┘                                 
-             ┘                               
-  ┌─           ┌─                ┌─          
-  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─        ╵ ┌─        
-    ╵  ╵  ╵      ╵"a"  ╵"b"        ╵"ab"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-    ┌┐ ┌┐ ┌┐     ┌─    ┌─          ┌─        
-    ╵  ╵  ╵      ╵"c"  ╵"d"        ╵"cd"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-    ┌┐ ┌┐ ┌┐     ┌─    ┌─          ┌─        
-    ╵  ╵  ╵      ╵"e"  ╵"f"        ╵"ef"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-             ┘               ┘            ┘  
-  ┌─           ┌─                ┌─          
-  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─        ╵ ┌─        
-    ╵  ╵  ╵      ╵"a   ╵"b         ╵"ab      
-                   c"    d"          cd"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-    ┌┐ ┌┐ ┌┐     ┌─    ┌─          ┌─        
-    ╵  ╵  ╵      ╵"c   ╵"d         ╵"cd      
-                   e"    f"          ef"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-             ┘               ┘            ┘  
-  ┌─           ┌─                ┌─          
-  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─        ╵ ┌─        
-    ╵  ╵  ╵      ╵"a   ╵"b         ╵"ab      
-                   c     d           cd      
-                   e"    f"          ef"     
-     ┘  ┘  ┘         ┘     ┘            ┘    
-             ┘               ┘            ┘  
-                                            ┘
+┌─                                         
+╵ ┌─           ┌─              ┌─          
+  ╵ ┌┐ ┌┐ ┌┐   ╵ ↕0‿1 ↕0‿1     ╵ ↕0‿2      
+    └┘ └┘ └┘     ↕0‿1 ↕0‿1       ↕0‿2      
+    ┌┐ ┌┐ ┌┐     ↕0‿1 ↕0‿1       ↕0‿2      
+    └┘ └┘ └┘     ↕0‿1 ↕0‿1       ↕0‿2      
+    ┌┐ ┌┐ ┌┐               ┘          ┘    
+    └┘ └┘ └┘                               
+    ┌┐ ┌┐ ┌┐                               
+    └┘ └┘ └┘                               
+             ┘                             
+  ┌─           ┌─              ┌─          
+  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─      ╵ ┌─        
+    ╵  ╵  ╵      ╵"a"  ╵"b"      ╵"ab"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+    ┌┐ ┌┐ ┌┐     ┌─    ┌─        ┌─        
+    ╵  ╵  ╵      ╵"c"  ╵"d"      ╵"cd"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+    ┌┐ ┌┐ ┌┐     ┌─    ┌─        ┌─        
+    ╵  ╵  ╵      ╵"e"  ╵"f"      ╵"ef"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+             ┘               ┘          ┘  
+  ┌─           ┌─              ┌─          
+  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─      ╵ ┌─        
+    ╵  ╵  ╵      ╵"a   ╵"b       ╵"ab      
+                   c"    d"        cd"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+    ┌┐ ┌┐ ┌┐     ┌─    ┌─        ┌─        
+    ╵  ╵  ╵      ╵"c   ╵"d       ╵"cd      
+                   e"    f"        ef"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+             ┘               ┘          ┘  
+  ┌─           ┌─              ┌─          
+  ╵ ┌┐ ┌┐ ┌┐   ╵ ┌─    ┌─      ╵ ┌─        
+    ╵  ╵  ╵      ╵"a   ╵"b       ╵"ab      
+                   c     d         cd      
+                   e"    f"        ef"     
+     ┘  ┘  ┘         ┘     ┘          ┘    
+             ┘               ┘          ┘  
+                                          ┘
 

This array can be joined, indicating that the length of each inner axis depends only on the position in the corresponding outer axis (let's also drop those empty slices to take up less space).

↗️
     11  ((1+≢)<2¨<) 32"abcdef"
@@ -171,44 +171,44 @@
 ↗️
    Prefs  (1+≢)¨<
     Suffs  (1+≢)¨<
     Prefs¨Suffs 32"abcdef"
-┌─                                           
-╵ ┌─                   ┌─            ┌─      
-  ╵ ┌┐ 0‿1⥊⟨⟩ 0‿2⥊⟨⟩   ╵ ┌┐ 0‿1⥊⟨⟩   ╵ ┌┐    
-    └┘                   └┘            └┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"a"   ╵"ab"      ╵  ╵"b"       ╵     
-     ┘     ┘       ┘      ┘     ┘       ┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"a    ╵"ab       ╵  ╵"b        ╵     
-         c"     cd"           d"             
-     ┘     ┘       ┘      ┘     ┘       ┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"a    ╵"ab       ╵  ╵"b        ╵     
-         c      cd            d              
-         e"     ef"           f"             
-     ┘     ┘       ┘      ┘     ┘       ┘    
-                     ┘             ┘      ┘  
-  ┌─                   ┌─            ┌─      
-  ╵ ┌┐ 0‿1⥊⟨⟩ 0‿2⥊⟨⟩   ╵ ┌┐ 0‿1⥊⟨⟩   ╵ ┌┐    
-    └┘                   └┘            └┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"c"   ╵"cd"      ╵  ╵"d"       ╵     
-     ┘     ┘       ┘      ┘     ┘       ┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"c    ╵"cd       ╵  ╵"d        ╵     
-         e"     ef"           f"             
-     ┘     ┘       ┘      ┘     ┘       ┘    
-                     ┘             ┘      ┘  
-  ┌─                   ┌─            ┌─      
-  ╵ ┌┐ 0‿1⥊⟨⟩ 0‿2⥊⟨⟩   ╵ ┌┐ 0‿1⥊⟨⟩   ╵ ┌┐    
-    └┘                   └┘            └┘    
-    ┌┐ ┌─     ┌─         ┌┐ ┌─         ┌┐    
-    ╵  ╵"e"   ╵"ef"      ╵  ╵"f"       ╵     
-     ┘     ┘       ┘      ┘     ┘       ┘    
-                     ┘             ┘      ┘  
-  ┌─                   ┌─            ┌─      
-  ╵ ┌┐ 0‿1⥊⟨⟩ 0‿2⥊⟨⟩   ╵ ┌┐ 0‿1⥊⟨⟩   ╵ ┌┐    
-    └┘                   └┘            └┘    
-                     ┘             ┘      ┘  
-                                            ┘
+┌─                                         
+╵ ┌─                  ┌─           ┌─      
+  ╵ ┌┐ ↕0‿1  ↕0‿2     ╵ ┌┐ ↕0‿1    ╵ ┌┐    
+    └┘                  └┘           └┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"a"  ╵"ab"      ╵  ╵"b"      ╵     
+     ┘     ┘      ┘      ┘     ┘      ┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"a   ╵"ab       ╵  ╵"b       ╵     
+         c"    cd"           d"            
+     ┘     ┘      ┘      ┘     ┘      ┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"a   ╵"ab       ╵  ╵"b       ╵     
+         c     cd            d             
+         e"    ef"           f"            
+     ┘     ┘      ┘      ┘     ┘      ┘    
+                    ┘            ┘      ┘  
+  ┌─                  ┌─           ┌─      
+  ╵ ┌┐ ↕0‿1  ↕0‿2     ╵ ┌┐ ↕0‿1    ╵ ┌┐    
+    └┘                  └┘           └┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"c"  ╵"cd"      ╵  ╵"d"      ╵     
+     ┘     ┘      ┘      ┘     ┘      ┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"c   ╵"cd       ╵  ╵"d       ╵     
+         e"    ef"           f"            
+     ┘     ┘      ┘      ┘     ┘      ┘    
+                    ┘            ┘      ┘  
+  ┌─                  ┌─           ┌─      
+  ╵ ┌┐ ↕0‿1  ↕0‿2     ╵ ┌┐ ↕0‿1    ╵ ┌┐    
+    └┘                  └┘           └┘    
+    ┌┐ ┌─    ┌─         ┌┐ ┌─        ┌┐    
+    ╵  ╵"e"  ╵"ef"      ╵  ╵"f"      ╵     
+     ┘     ┘      ┘      ┘     ┘      ┘    
+                    ┘            ┘      ┘  
+  ┌─                  ┌─           ┌─      
+  ╵ ┌┐ ↕0‿1 ↕0‿2      ╵ ┌┐ ↕0‿1    ╵ ┌┐    
+    └┘                  └┘           └┘    
+                 ┘              ┘       ┘  
+                                          ┘
 
-- cgit v1.2.3