From e2b07a5fd0bbaad232c717fb90a31d6c61d72bd4 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 14 Jul 2022 20:06:50 -0400 Subject: Try to include previous variable definitions in REPL links --- docs/doc/train.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/doc/train.html') diff --git a/docs/doc/train.html b/docs/doc/train.html index 61e253ea..1f7c1f5b 100644 --- a/docs/doc/train.html +++ b/docs/doc/train.html @@ -52,20 +52,20 @@ ⟨ 0 1 2 3 0 0 4 1 3 5 6 ⟩

Each 't' is 0, each 'a' is 1, and so on. We'd like to discard some of the information from Classify, to just find whether each major cell had a new value. Here are the input and desired result:

-↗️
    sc   "tacittrains"
+↗️
    sc   "tacittrains"
 ┌─                       
 ╵ 0 1 2 3 0 0 4 1 3 5 6  
   1 1 1 1 0 0 1 0 0 1 1  
                         ┘
 

The result should be 1 when a new number appears, higher than all the previous numbers. To do this, we first find the highest previous number by taking the maximum-scan ` of the argument, then shifting to move the previous maximum to the current position. The first cell is always new, so we shift in a ¯1, so it will be less than any element of the argument.

-↗️
    ¯1 » `sc
+↗️
    ¯1 » `sc
 ⟨ ¯1 0 1 2 3 3 3 4 4 4 5 ⟩
     (¯1»⌈`) sc
 ⟨ ¯1 0 1 2 3 3 3 4 4 4 5 ⟩
 

Now we compare the original list with the list of previous-maximums.

-↗️
    sc > ¯1»⌈`sc
+↗️
    sc > ¯1»⌈`sc
 ⟨ 1 1 1 1 0 0 1 0 0 1 1 ⟩
     (⊢>¯1»⌈`) sc
 ⟨ 1 1 1 1 0 0 1 0 0 1 1 ⟩
-- 
cgit v1.2.3