Array Notation: format and evaluate

General APL language issues

Array Notation: format and evaluate

Postby Phil Last on Wed Sep 28, 2022 10:16 pm

While array notation is easy to compose by hand for small bespoke arrays something that will need to be decided by each provider that implements it is a function to format (encode / serialise) an existing array as array notation to be embedded in a defined operation or script, written to file or passed as argument to another operation.
This could be an extension to either of format (⍕) or ⎕FMT and is currently modelled as Serialise in Link and encode in Acre.

Evaluation (decode / deserialise) will occur automatically when the containing source code is run but will also need a method that takes the source code as argument as ⎕JSON does for that notation.
Again this could be an extension to execute (⍎) and is currently Deserialise in Link and decode in Acre.

Consideration will need to be given to the structure of the text result of format that forms the argument to evalute. To follow the precedent of the models in both Link and Acre evaluate would have to handle any of three structures: a simple line-end separated string, a list of simple strings or a two dimensional table. Link Serialise returns a list of strings, Acre encode a simple CR (U+000D) separated string. Whichever is chosen it should be possible as often as possible to select and copy it from the session in order subsequently to paste it into source code.

A thornier issue is how format and evaluate should handle what at their most general may be called "dictionaries" or "associative arrays". Referred to as namespaces in Dyalog APL and the specification at, a simpler exanple of a dictionary might be a set of name:value pairs structured as a pair of lists or a list of pairs. For the benefit of interoperability it would be useful if all implementors accepted the same notation:((n:v ⋄ n:v)) for their favoured implementation but they would need to code format to recognise what particular array structure should be accorded that status and evaluate what structure to (re)create.
User avatar
Phil Last
Posts: 606
Joined: Thu Jun 18, 2009 6:29 pm

Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest