Difference between revisions of "Format"

From APL Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
== Examples ==
 
== Examples ==
  
Format in its [[monadic]] form, alongside [[ravel]], allows the user to concatenate numbers with strings:
+
Format in its [[monadic]] form, allows the user to convert [[array]]s of any [[type]] into [[simple]] character arrays (for example for concatenation with other character arrays):
 
<source lang=apl>
 
<source lang=apl>
 
       supper ← 10
 
       supper ← 10
Line 9: Line 9:
 
I ate 10 shrimp.
 
I ate 10 shrimp.
 
</source>
 
</source>
It is very powerful when combined with [[execute]], which allows the user to interpret a string as APL code:
+
It is very powerful when combined with [[Execute]], allowing the user to construct APL code:
 
<source lang=apl>
 
<source lang=apl>
 
       data ← 7
 
       data ← 7
Line 15: Line 15:
 
42
 
42
 
</source>
 
</source>
 +
{{APL built-ins}}

Revision as of 13:39, 10 February 2020

Format () is a primitive function.

Examples

Format in its monadic form, allows the user to convert arrays of any type into simple character arrays (for example for concatenation with other character arrays):

      supper  10
      'I ate ',(supper),' shrimp.'
I ate 10 shrimp.

It is very powerful when combined with Execute, allowing the user to construct APL code:

       data  7
       '6 × ',⍕data
42
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