Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕TF Transfer Form
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕TF Transfer Form


The dyadic system function ⎕TF returns the Transfer Form of the item whose name is its right argument. Alternatively it will decode any transfer form supplied as its right argument and return the name of the successfully decoded object. The transfer form of an object is a text representation of an APL variable, function or operator, suitable for transmission between dissimilar computer systems or implementations of APL. Two forms are allowed, the standard and extended forms. The standard form consists of a header portion and a data portion, with the header having the following format:

       Name                          Description
       Type Code                     'F' for function
                                     'N' for a numeric array
                                     'C' for a character array
       Name                          Name of the object, followed by a blank
       Rank                          Character form of the rank of the object
       Shape                         Character form of the shape of the object
                                     followed by a blank
       Data                          Character form of the object

The standard transfer form cannot be used for mixed or nested variables or for user-defined operators.

The extended transfer form is a character string which, if executed, would reconstitute the item in question.

If the ⎕TF function is unsuccessful, an empty vector is returned.

See also the )OUT and )IN system commands which will decode or create Transfer Forms for a list of objects.

             SIMPLE←'TEXT STRING'    (Sample data)
             MIXED←'ABC' (2 2⍴⍳4)
             ∇R←A FN B
       [1]   R←A ÷ B
       [2]   ∇

Encoding items:

             1 ⎕TF 'SIMPLE'          (Standard transfer form)
       CSIMPLE 1 11 TEXT STRING      (Character, rank 1, shape 11)
             1 ⎕TF 'MIXED'           (Standard transfer form won't work on mixed)
             1 ⎕TF 'FN'
       FFN 2 2 8 R←A FN BR←A÷B       (Function called FN, rank 2, shape 2 8)
             2 ⎕TF 'SIMPLE'          (Extended transfer form)
       SIMPLE←'TEXT STRING'
             2 ⎕TF 'MIXED'
       MIXED←('ABC') (2 2⍴1 2 3 4)
             2 ⎕TF 'FN'
       ⎕FX 'R←A FN B' 'R←A÷B'
             1 ⎕TF '⎕WA'             (Similar format to encode system variables)
       N⎕WA 0 740322
             2 ⎕TF '⎕WA'
       ⎕WA←740322
             1 ⎕TF '⎕PW'
       N⎕PW 0 80
             2 ⎕TF '⎕TS'
       ⎕TS←1990 5 31 0 36 52 734

Decoding objects:

             TF1←1 ⎕TF 'SIMPLE'
             TF2←2 ⎕TF 'MIXED'
             )ERASE SIMPLE MIXED     (Remove the original objects)
             )VARS
       TF1     TF2
             1 ⎕TF TF1               (Successful decode - name returned)
       SIMPLE
             )VARS
       SIMPLE  TF1     TF2           (Object reappears)
             1 ⎕TF TF2               (Attempt to decode an extended version)
                                     (Empty vector and no object)
             )VARS
       SIMPLE  TF1     TF2
             2 ⎕TF TF2               (Decode using the correct, extended form)
       MIXED

Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕TF Transfer Form
[ Previous | Next | Contents | Index | APL Home ]