From 29509cedb9af2715328e44c481738a9ba05cff73 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 3 Nov 2021 15:51:15 -0400 Subject: =?UTF-8?q?Use=20=E2=8B=88=20rather=20than=20=E2=89=8D=E2=97=8B -

Reverse is useful for folding left to right instead of right to left.

-↗️
    < ´   "abcd"  # Right to left
+

Reverse is useful for folding left to right instead of right to left (here we use Pair to show structure).

+↗️
     ´   "abcd"  # Right to left
 ⟨ 'a' ⟨ 'b' "cd" ⟩ ⟩
 
-    <˜´  "abcd"  # Left to right
+    ˜´  "abcd"  # Left to right
 ⟨ ⟨ "ab" 'c' ⟩ 'd' ⟩
 

Reverse is its own inverse . As a result, 𝔽 reverses the argument, applies 𝔽, and reverses again. It's a particularly useful pattern with Scan, as it allows scanning from the end rather than the beginning of the array. For example, ` on a list of booleans changes all bits after the first 1 to 1, but ` does this to all bits before the last 1.

@@ -47,10 +47,10 @@ ERROR

Rotate

Rotate moves elements in a list around cyclically. It can also rotate any number of axes of the argument array by different amounts at once. That's discussed in the next section; for now we'll stick to a single number for 𝕨. It has to be an integer, and 𝕩 has to be an array with at least one axis.

-↗️
    2  "rotate"
+↗️
    2  "rotate"
 "tatero"
 
-    2 ( < ) 52"rotateCELL"
+    2 (  ) 52"rotateCELL"
 ┌─               
 · ┌─     ┌─      
   ╵"ro   ╵"te    
-- 
cgit v1.2.3