Difference between revisions of "Execute"

From APL Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Built-in|Execute|⍎}} is a [[primitive function]]. It allows the user to interpret 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 [[assignment|assign]] a value using a name given by a variable:
 +
<source lang=apl>
 +
      varName←'myVar'
 +
      myValue←42
 +
      {⍎varName,'←⍵'}myValue
 +
      varName
 +
myVar
 +
      myVar
 +
42
 +
</source>
 +
== 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]
 +
{{APL built-ins}}[[Category:Primitive functions]]

Latest revision as of 10:26, 9 July 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'
      myValue42
      {varName,'←⍵'}myValue
      varName
myVar
      myVar
42

See also

External links

Tutorials

Documentation

APL built-ins [edit]
Primitive functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentitySelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndex
Selector Index generatorGradeIndex OfInterval IndexIndicesDeal
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Primitive operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-beamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Atop, Over) ∙ Inner ProductPowerAtUnderRankDepthVariantStencilCut (J)
Quad names
Arrays Index originMigration levelAtomic vector
Functions Case convertUnicode convert
Operators SearchReplace