Execute: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
No edit summary
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(7 intermediate revisions by 3 users not shown)
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]] (<syntaxhighlight lang=apl inline>⎕VI</syntaxhighlight>) and [[Fix Input]] (<syntaxhighlight lang=apl inline>⎕FI</syntaxhighlight>)or the combined function [[Verify and Fix Input]] (<syntaxhighlight lang=apl inline>⎕VFI</syntaxhighlight>).


== Examples ==
== Examples ==
<source lang=apl>
<syntaxhighlight lang=apl>
       ⍎'⍳10'
       ⍎'⍳10'
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
</source>
</syntaxhighlight>
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>
<syntaxhighlight lang=apl>
       varName←'myVar'
       varName←'myVar'
       myValue←42
       myValue←42
Line 15: Line 17:
       myVar
       myVar
42
42
</source>
</syntaxhighlight>
{{APL built-ins}}
== See also ==
* [[Format]]
== External links ==
=== Tutorials ===
* [https://chat.stackexchange.com/rooms/52405/conversation/lesson-10-apl-functions--#41868382 APL Cultivation]
=== Documentation ===
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Execute.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_710.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d601.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/quotedot NuVoc] (as <syntaxhighlight lang=j inline>".</syntaxhighlight>)
{{APL built-ins}}[[Category:Primitive functions]]

Latest revision as of 21:59, 10 September 2022

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

See also

External links

Tutorials

Documentation

APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector