Here are some features that I decided to document outside the tutorials. The features are not implemented on purpose, it's just... it was no use disabling them.
Comma operator's purpose is to build parameter lists for DATA instruction, or a function like MID$, or user defined functions of higher arities.
However, it is not illegal to assign such a list to a variable. You can construct a stack structure with it.
DEF HEAD(H,T)=H
DEF TAIL(H,T)=T
LIST=() 'EMPTY LIST
LIST="",LIST
LIST="TWO",LIST
LIST="THREE",LIST
LIST="FOUR",LIST
@LOOP
PRINT HEAD(LIST)
LIST = TAIL(LIST)
IF LEN(LIST) THEN GOTO LOOP
And this is how you create a list with only one element:
SINGLE=(),"THE ELEMENT"
There is a "length" index in the imeight program's arrays since those are implemented as JavaScript arrays. This prints 8.
DIM ARR()
ARR(7) = "E"
PRINT ARR("length")
Be aware that you cannot avoid NO VALUE errors using this hack completely. For instance, PRINT ARR(1) would bail out.
But if the array is guaranteed to be filled from index 0 or 1 without gap then "length" may come in handy.
Have you noticed that [Instructions] are accepted as [Names]? Now what happens if you give the name "CLR" or "PUSH" to a label or variable?
SPRX(6) = REM - A/GOTO:@A 'ALTERNATIVE WAY TO SAY, PUSH 6
The textual representation above will be parsed into postfix Polish: 6, SPRX(, REM, A, GOTO, /, -, LET, A, @, some remark, '
The label A will point to the end of this line.
When running,
1. value 6 pushed
2. SPRX( array name pushed
3. REM instruction executed: top of stack is considered remark, thrown away
4. name A pushed
5. GOTO executed, its argument is the name A, which is pulled from the stack: jumps over the operators and LET
Wiki: Home
Wiki: Instructions
Wiki: Names
Wiki: Overloaded Operators
Anonymous
Do you have imeight hacks? Just throw them here. Thanks a lot!
Last edit: Csaba Skrabák 2020-06-17