Section 29
Want more of a challenge? View in iconic form (experimental)



       # MATH show how to execute a sequence of instructions
[hear] (intro begin);

[hear] (define prev-translate / translate);

[hear] (define reverse /
         ? x /
         if (>= (list-length / x) 1)
          (prepend
            (last /
             x)
            (reverse /
             except-last /
             x))
          (x));

       # test reverse
[hear] (list= (vector 1 2 3) (reverse / vector 3 2 1));

[hear] (define translate /
         let ((prev (prev-translate)))
          (? x /
           if (number? /
             x)
            (prev /
             x)
            (if (= (head / x) begin)
              (translate
                (vector
                  (vector ? x (vector head (vector x)))
                  (prepend vector (reverse / tail / x))))
              (prev /
               x))));

[hear] (= (begin 1 7 2 4) 4);

[hear] (= (begin
             (set! (demo-mut1) 88)
             (set! (demo-mut1) 6)
             (get! /
              demo-mut1))
           6);

[hear] (= (begin
             (set! (demo-mut2) 88)
             (set! (demo-mut1) 6)
             (get! /
              demo-mut2))
           88);

[hear] (= (begin
             (set! (demo-mut1) 88)
             (set! (demo-mut1) 6)
             (get! /
              demo-mut1)
             4)
           4);