I-Beam (⌶
) is an operator that takes as its operand a numeric code and derives a function which isn’t really considered to be part of the APL language – for example: something which could be experimental, which might provide access to parts of the interpreter that should only be accessed with care, or may set up specific conditions within the interpreter to help in testing. Principally, I-Beam functions exist for internal use within Dyalog but as of version 15.0 there are 55 I-Beam functions that are published and available for general use. How on earth are you supposed to remember all the different codes?
To an extent, you are not. It is perhaps no bad thing that they are a little difficult to remember: I-Beam functions are experimental, liable to be changed or even removed and should be used with care. The codes appear to be somewhat random partly because they are somewhat random – mostly selected on the whim of the developer who implemented the function. However, some codes were chosen less randomly than others – quite a few are grouped so that I-Beams that provide related functionality appear consecutively or at least close together but the most interesting ones are “named” – or, at least, given a numeric code that is derived from a name or otherwise memorable value. So here are some of those unofficial mnemonics that may help you better remember them too.
A favourite trick for deriving a code from a meaningful name is to devise a name containing the letters I, V, X, L, C, D and M, and then convert that into a number as if it were a Roman numeral. Thus:
- “Inverted table IndeX of” is abbreviated to IIX, which is I-Beam 8
- “Syntax Colouring” rather awkwardly becomes “Cyntax Colouring”, thence CC and I-Beam 200
- “Called Monadically” is CM, or 900
- “Memory Manager” is MM – I-Beam 2000
- “Line Count” is LC, or rather L,C – 50100
Another favourite is to use numbers that look or sound like something else:
- The compression I-Beam is 219, which looks a bit like “ZIP”
- The case folding I-Beam is 819, or “BIg”
- When support for function trains was in development an I-Beam was used to switch between different implementations – 1060, or “lOCO[motive]” (this I-Beam is no longer in use)
- The number of parallel threads I-Beam is 1111 – four parallel lines
- The fork I-Beam is 4000: 4000 is 4K; “Four K” said very quickly might sound like “Fork”
For others the function is associated, or can be associated, with something already numeric:
- The I-Beam to update function timestamps is 1159 – a memorable time
- The I-Beam to delete the content in unused pockets is 127 – the same as the ASCII code for the delete character
- The draft JSON standard is RFC 7159 and support for it is implemented as
7159⌶
- The now-deprecated I-Beam to switch between Random Number Generator algorithms is 16807 – the default value used to derive the random seed in a clear workspace
Tips for the use of I-Beam functions
- Do not use I-Beam functions directly in application code – always encapsulate their use in cover-functions that can quickly be modified to protect your application in the event that Dyalog should change the behaviour of, or withdraw, an I-Beam function.
- Do not use I-Beam functions that are not documented by Dyalog in the Language Reference or elsewhere – those designed to test the interpreter may have undesirable side effects.
- Do let Dyalog know if you find an I-Beam function particularly useful and/or have suggestions for its development. Some new features are initially implemented as I-Beam functions to allow such feedback to shape their final design.
Delightful and thanks for sharing!
Serious question: are you a “4K means 4000” or “4K means 4096” kinda shop?! 🙂
Glad you enjoyed!
We tend to use the newer binary prefixes for powers of 2 – thus 4K means 4000, 4Ki means 4096. But context is everything – I’d still assume 4096 in “4KB of memory”, even though these days that ought to be “4KiB of memory”.