Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕EC Execute Controlled
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕EC Execute Controlled


The monadic system function ⎕EC will execute its argument and return a result which is a three item vector containing a return code, the error type and the result (or ⎕EM) respectively. The return code is an integer in the range 0 to 5

       0     Error
       1     Expression with a result which would display
       2     Expression with a result which would not display
       3     Expression with no explicit result
       4     Branch to a line
       5     Naked branch

The second item is the value that would be returned by ⎕ET (without altering the current value of ⎕ET). The third item is the result (if one is generated); for return code 3 or 5 the third item is 0 0⍴0; for return code 4 the third item is the argument to the branch; for return code 0 the third item is ⎕EM.

             ⎕ET
       0 0
             ⎕EC '2×''A'''
        0  5 4  DOMAIN ERROR          (Error, ⎕ET, ⎕EM)
                     2×'A'
                     ^
             ⎕ET
       0 0                           (⎕ET has not changed)

⎕EC overrides any ⎕STOP settings

             ∇TEST
       [1]     2×5
       [2]     +/⍳100
       [3]     ∇
             1 ⎕STOP 'TEST'          (Stop set on line 1)
       1
             ⎕EC 'TEST'              (Execute TEST under ⎕EC)
       10
       5050
       3  0 0                        (No explicit result, ⎕ET, empty vector)
             ⎕STOP 'TEST'            (Stop setting still active)
       1

Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕EC Execute Controlled
[ Previous | Next | Contents | Index | APL Home ]