Component Files and ⎕IO
Posted: Mon Aug 30, 2021 2:21 pm
Components in a Dyalog Component file are allocated consecutively starting at 1 independently from the value of ⎕IO. This is inline with STSC's and Sharp's component files on mainframes if I remember correctly.
Now I come to think about it, this seems strange.
In general I prefer to work in ⎕IO 1, but have recently changed my ants visualisation class (running under MiServer) over to using index origin 0. This was partially because the documentation for the 2004 ICFP Programming Contest - "Dinner with Ambiants" was written in index origin 0. But also because Encode and Decode are a lot easier to use in origin zero, and my code was frequently out by 1!
In my mainframe APL days, "we" strictly observed standard layouts for component file which allowed utility programs to read them document them. (As Peter Merritt said: "Standards are good, everybody should have their own.")
In those days when, workspaces were small, component files were often used to split up large matrices into smaller batches that could be handled in the workspace.
The standard layout was along the lines of:
Component 1 - A short text description for the file and its name.
Component 2 - A text matrix index of the file, one row per component, describing what was i that component (This text)
Component 3 - A text matrix containing the full documentation about the file
Component 4 - The component number for the first batch of data (say 10)
Components 5-9 non standard utility information (such as look-up) or empty for future use
Component 10 - keys to the First batch of data
Component 11 - keys to the Second batch of data
Etc
In some respect this data started at origin 10!
Files for multi user update were more complex with for instance, alternate Index components, one for reading and another for writing.
For such component files I would have not considered using index origin zero for numbering the components.
Might there be a good case for allowing for a component Zero?
Now I come to think about it, this seems strange.
In general I prefer to work in ⎕IO 1, but have recently changed my ants visualisation class (running under MiServer) over to using index origin 0. This was partially because the documentation for the 2004 ICFP Programming Contest - "Dinner with Ambiants" was written in index origin 0. But also because Encode and Decode are a lot easier to use in origin zero, and my code was frequently out by 1!
In my mainframe APL days, "we" strictly observed standard layouts for component file which allowed utility programs to read them document them. (As Peter Merritt said: "Standards are good, everybody should have their own.")
In those days when, workspaces were small, component files were often used to split up large matrices into smaller batches that could be handled in the workspace.
The standard layout was along the lines of:
Component 1 - A short text description for the file and its name.
Component 2 - A text matrix index of the file, one row per component, describing what was i that component (This text)
Component 3 - A text matrix containing the full documentation about the file
Component 4 - The component number for the first batch of data (say 10)
Components 5-9 non standard utility information (such as look-up) or empty for future use
Component 10 - keys to the First batch of data
Component 11 - keys to the Second batch of data
Etc
In some respect this data started at origin 10!
Files for multi user update were more complex with for instance, alternate Index components, one for reading and another for writing.
For such component files I would have not considered using index origin zero for numbering the components.
Might there be a good case for allowing for a component Zero?