⍝ Quad_EA.tc
⍝ ----------------------------------

      '⍳3' ⎕EA '⍳4.5'
1 2 3
 
      '⍳3' ⎕EA '⍳4'
1 2 3 4


      '⍳3.3' ⎕EA '⍳4.5'
DOMAIN ERROR
      ⍳3.3
      ^
⍝     '⍳3.3' ⎕EA '⍳4.5'
⍝     ^      ^

      →

      '"ERR"' ⎕EA '⍳4.5'
ERR

      'Z←⍳8' ⎕EA 'Z←!¯3'
      Z
1 2 3 4 5 6 7 8


      ⍝ )SI unchanged after failure of user-defined function
      ⍝
      )ERASE foo_fails

∇foo_fails B
 →(B>0)⍴⎕LC+1 ◊ ÷0
 foo_fails B-1
∇

      )SIC
      ⎕SI 2
0

      foo_fails 2
DOMAIN ERROR
foo_fails[1]  ÷0
              ^
      ⎕SI 2
0 2 2 1 0

      'ι3' ⎕EA 'foo_fails'
1 2 3

      ⎕SI 2
0 2 2 1 0
      )SIC

   ⍝ ⎕EA with branch ----------------------------------
   ⍝
∇FOO_branch
 'line-1'
 '→ERR' ⎕EA '++'
 'line-3 reached (error)' ◊ →0
ERR: "⎕EA succeeded with its left (branch-) argument '→ERR'"
 'line-5'
 'OK' ⎕EA '→OK'
 'line-7 reached (error)' ◊ →0
OK: "⎕EA succeeded with its right (branch-) argument '→OK'"
∇

      FOO_branch
line-1
⎕EA succeeded with its left (branch-) argument '→ERR'
line-5
⎕EA succeeded with its right (branch-) argument '→OK'

      )SI

      )SIC
      )ERASE foo_fails FOO_branch

      )CHECK
OK      - no stale functions
OK      - no stale values
OK      - no stale indices
OK      - no duplicate parents

⍝ Escape ----------------------------------

      )SIC
      )CHECK
OK      - no stale functions
OK      - no stale values
OK      - no stale indices
OK      - no duplicate parents

      )ERASE FOO

∇A FOO B
 →(B=0)⍴GOON ◊ A FOO B-1 ◊ →0
 GOON: ⎕SI 3 ◊ →(A=1 2 3)/ 0 ESC BRA
 ESC: '→'   ⎕EA '⍳2.5' ◊ 'NOT-REACHED: FOO(ESC)'
 BRA: '→LP' ⎕EA '⍳2.5' ◊ 'NOT-REACHED: FOO(BRA)'
      'NOT-REACHED: FOO(BRA+1)'
 LP: 'REACHED: FOO(LP)'
∇

      ⍝ build an )SI stack
      1 FOO 3
 ◊[0] FOO[1] FOO[1] FOO[1] FOO[2] 

      2 FOO 3
 ◊[0] FOO[1] FOO[1] FOO[1] FOO[2] 

      ⎕SI 3    ⍝ expect )SI cleared
 ◊[0] 

      3 FOO 3    ⍝ expect branch taken
 ◊[0] FOO[1] FOO[1] FOO[1] FOO[2] 
REACHED: FOO(LP)

      →

⍝ ==================================

