System Function EC
⎕EC  Execute Controlled


Z←⎕EC R where argument R is a string expression and returned Z is a 3element [mixed, nested] vector. 
Monadic Function


R should be a string expression. ⎕EC is frequently used for testing and debugging purposes. 
Return codes for Z: Normally, the first element of the return code (in variable Z) represents an integer in the range 0 to 5, where:
0 = Error
1 = Expression with a result which would display (for debugging purposes this means OK, R was not problematic.
2 = Expression with a result which would not display
3 = Expression with no explicit result
4 = Branch to a line
5 = Niladic goto / branch
The second item in Z (returned) is the value that would be returned by ⎕ET (quad event type, without altering the current value of ⎕ET). The third item returned is the actual 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.
Quad Execute Controlled ⎕EC sample monadic calls:
Z←⎕EC 'a÷1' ⍝ Right argument FAILS(a÷1, because variable "a" does NOT exist). ⍴Z 3 ⍝ Thus a standard 3element vector has been returned in Z Z ⍝ Let's see what Z looks like: 0 0 0 VALUE ERROR ⍎ a÷1 ∧ Z[1] ⍝ first element in Z is the return code, a zero was generated in this case, indicating an error, as listed above. 0 Z[2] 0 0 Z[3] ⍝ third element returned in Z is the actual nested string error message. VALUE ERROR ⍎ a÷1 ∧ ⍝ A different test with "no problems" example: Z←⎕EC '6÷0.5' ⍝ RIGHT argument SUCCEEDS(6÷0.5) because 6 can be divided by 0.5; under normal circumstances the answer would be 12. ⍴Z 3 Z 1 0 0 12 Z[1] ⍝ first element in Z is the return code, a one was generated in this case, indicating no problem, as per the list above. 1 ⍝ again, 1 = success, no problems encountered Z[2] 0 0 Z[3] 12 ⍝ And Z[3] correctly holds the expected answer.
The Execute Controlled system function normally takes a string as its right argument. In particular the left argument string may normally:
 call a function
 jump to a particular label
 perform ANY allowed APL operation (e.g. addition, multiplication, division, subtraction, floor, ceiling, logic test, etc...)
 assign/set a value
See also: ⎕EA
System Variables (A value may be assigned to these except for ⎕DM)  

⎕ALX  ⎕CT  ⎕DM  ⎕DT  ⎕ELX  ⎕FC  ⎕FEATURE  ⎕FPC  ⎕IC  ⎕IO 
⎕LR  ⎕LX  ⎕PP  ⎕PR  ⎕PW  ⎕RL  ⎕SA  ⎕WSID  
Niladic System Functions (a value cannot be assigned to these)  
⎕A  ⎕AV  ⎕EM  ⎕ET  ⎕LC  ⎕NNAMES  ⎕NNUMS  ⎕SI  ⎕SYSID  ⎕SYSVER 
⎕T  ⎕TC  ⎕TCBEL  ⎕TCBS  ⎕TCESC  ⎕TCFF  ⎕TCHT  ⎕TCLF  ⎕TCNL  ⎕TCNUL 
⎕TS  ⎕WA  
Monadic or dyadic system functions (a value cannot be assigned to these)  
⎕AT  ⎕CR  ⎕DC  ⎕DFT  ⎕DL  ⎕DR  ⎕EA  ⎕EC  ⎕ERROR  ⎕ES 
⎕EX  ⎕FMT  ⎕FX  ⎕MF  ⎕NAPPEND  ⎕NC  ⎕NCREATE  ⎕NERASE  ⎕NINFO  ⎕NL 
⎕NLOCK  ⎕NREAD  ⎕NRENAME  ⎕NREPLACE  ⎕NRESIZE  ⎕NSIZE  ⎕NTIE  ⎕NUNTIE  ⎕STOP  ⎕TF 
⎕TRACE  ⎕UCS  ⎕VR  
Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive 
See Also  
System Commands  System Variables and Functions  Operators 
Keyboard  
A+S  ⍪  ≡  ≢  ⍒  ⍋  ⌽  ⍉  ⊖  ⍟  ⍱  ⍲  ⍠  ⌹  
Alt  ⋄  ¨  ¯  <  ≤  ∅  ≥  >  ≠  ∨  ∧  ×  ÷  
Sh  ~  !  @  #  $  %  ^  &  *  (  )  _  +  
Key  `  1  2  3  4  5  6  7  8  9  0    =  
A+S  ⍷  √  ⍨  ⍸  ⍥  ⍣  ⍞  ⍬  ⊣  
Alt  ?  ⍵  ∊  ⍴  §  ↑  ↓  ⍳  ○  π  ←  →  ⊢  
Sh  Q  W  E  R  T  Y  U  I  O  P  {  }    
Key  q  w  e  r  t  y  u  i  o  p  [  ]  \  
A+S  ∫  ∂  ⌻  ⍢  ⍙  ⍤  ⍫  ⌷  
Alt  ⍺  ⌈  ⌊  ∞  ∇  ∆  ∘  ‼  ⎕  ⍎  ⍕  
Sh  A  S  D  F  G  H  J  K  L  :  "  
Key  a  s  d  f  g  h  j  k  l  ;  '  
A+S  ⊆  ⊇  ⍡  ⍭  ⊙  
Alt  ⊂  ⊃  ∩  ∪  ⊥  ⊤  ⍦  ⍝  ⍀  ⌿  
Sh  Z  X  C  V  B  N  M  <  >  ?  
Key  z  x  c  v  b  n  m  ,  .  / 
NARS 2000 Lang Tool Bar 
←  →  +    ×  ÷  *  ⍟  ⌹  ○  !  ?  √    ⌈  ⌊  ⊥  ⊤  ⊣  ⊢  
≡  ≢  <  ≤  =  ≥  >  ≠  ∨  ∧  ⍱  ⍲  ↑  ↓  ⊂  ⊃  ⌷  ⍋  ⍒  
⍳  ∊  ⍸  ⍷  ∪  ∩  ⊆  ⊇  ~  §  π  ..  ,  ⍪  ⍴  ⌽  ⊖  ⍉  
/  \  ⌿  ⍀  ⊙  ¨  ⍨  ⍤  ⍣  ⍡  ⍥  ⍦  ⍥  .  ∘  ⍠  ‼  ⌻  ∂  ⍞  ⎕  ⍎  ⍕  
⋄  ⍝  ∇  ∆  ⍙  _  ⍺  ⍵  ¯  ⍬  ∞  ∅  
Second Row  i j k  i j k l  g  p  r  v  x 
[[Category:Mouse Group {{{1}}}{{{2}}}]]