Execute

From APL Wiki
Revision as of 21:08, 10 September 2022 by Adám Brudzewsky (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")
Jump to navigation Jump to search

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 (<syntaxhighlight lang=apl inline>⎕VI</source>) and Fix Input (<syntaxhighlight lang=apl inline>⎕FI</source>)or the combined function Verify and Fix Input (<syntaxhighlight lang=apl inline>⎕VFI</source>).

Examples

<syntaxhighlight lang=apl>

     ⍎'⍳10'

1 2 3 4 5 6 7 8 9 10 </source> A common use for this is to assign a value using a name given by a variable: <syntaxhighlight lang=apl>

     varName←'myVar'
     myValue←42
     {⍎varName,'←⍵'}myValue
     varName

myVar

     myVar

42 </source>

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