From eecbb6875af7dcc40d016eae596bf508e9a3ae57 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 20 Jul 2020 14:54:19 -0400 Subject: Don't print assignment results when auto-running code --- docs/doc/group.html | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'docs/doc/group.html') diff --git a/docs/doc/group.html b/docs/doc/group.html index 8a562285..88e02f29 100644 --- a/docs/doc/group.html +++ b/docs/doc/group.html @@ -18,9 +18,6 @@ a b c d e

For example, we might choose to group a list of words by length. Within each group, cells maintain the ordering they had in the list originally.

    phrase  "BQN""uses""notation""as""a""tool""of""thought"
-┌───┬────┬────────┬──┬─┬────┬──┬───────┐
-│BQN│uses│notation│as│a│tool│of│thought│
-└───┴────┴────────┴──┴─┴────┴──┴───────┘
     ˘ ¨ phrase
 ┌───────────┐
 │⟨⟩         │
@@ -126,13 +123,7 @@ caeb
 

Applications

The obvious application of Group is to group some values according to a known or computed property. If this property isn't an integer, it can be turned into one using Unique and Index Of (the combination has been called "self-classify").

    ln  "Phelps""Latynina""Bjørgen""Andrianov""Bjørndalen"
-┌──────┬────────┬───────┬─────────┬──────────┐
-│Phelps│Latynina│Bjørgen│Andrianov│Bjørndalen│
-└──────┴────────┴───────┴─────────┴──────────┘
     co  "US"    "SU"      "NO"     "SU"       "NO"
-┌──┬──┬──┬──┬──┐
-│US│SU│NO│SU│NO│
-└──┴──┴──┴──┴──┘
     ˘ co  ln
 ┌────────────────────┐
 │┌──────┐            │
@@ -150,9 +141,6 @@ caeb
 

If we would like a particular index to key correspondence, we can use a fixed left argument to Index Of.

    countries  "IT""JP""NO""SU""US"
-┌──┬──┬──┬──┬──┐
-│IT│JP│NO│SU│US│
-└──┴──┴──┴──┴──┘
     countries ˘ co countries ln
 ┌──┬────────────────────┐
 │IT│⟨⟩                  │
@@ -174,9 +162,6 @@ caeb
 

However, this solution will fail if there are trailing keys with no values. To force the result to have a particular length you can append that length as a dummy index to each argument, then remove the last group after grouping.

    countries  "IT""JP""NO""SU""US""ZW"
-┌──┬──┬──┬──┬──┬──┐
-│IT│JP│NO│SU│US│ZW│
-└──┴──┴──┴──┴──┴──┘
     countries ˘ co countries{𝕗(¯1↓⊔((𝕗)))} ln
 ┌──┬────────────────────┐
 │IT│⟨⟩                  │
-- 
cgit v1.2.3