Execute: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Built-in|Execute|⍎}} is a [[primitive function]] that evaluates a [[string]] as APL code. | {{Built-in|Execute|⍎}} is a [[primitive function]] that evaluates a [[string]] as APL code. | ||
It should be noted that executing user-provided data is not safe. Some implementations provide alternative safe functionality through the [[system function]]s [[Verify Input]] (<source lang=apl inline>⎕VI</source>) and [[Fix Input]] (<source lang=apl inline>⎕FI</source>)or the combined function [[Verify and Fix Input]] (<source lang=apl inline>⎕VFI</source>). | |||
== Examples == | == Examples == | ||
Line 6: | Line 8: | ||
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 | ||
</source> | </source> | ||
A common use for this is to assign a value using a name given by a variable: | A common use for this is to [[assignment|assign]] a value using a name given by a variable: | ||
<source lang=apl> | <source lang=apl> | ||
varName←'myVar' | varName←'myVar' |
Revision as of 13:51, 10 February 2020
⍎
|
Execute (⍎
) is a primitive function that evaluates a string as APL code.
It should be noted that executing user-provided data is not safe. Some implementations provide alternative safe functionality through the system functions Verify Input (⎕VI
) and Fix Input (⎕FI
)or the combined function Verify and Fix Input (⎕VFI
).
Examples
⍎'⍳10' 1 2 3 4 5 6 7 8 9 10
A common use for this is to assign a value using a name given by a variable:
varName←'myVar' myValue←42 {⍎varName,'←⍵'}myValue varName myVar myVar 42