,---------------. | Contributions | `---------------´ ,------------------------------------------ | 2021-08-20 20:54:31 MatteoVitturi wrote: | comment - There is an error in testing | see: https://forth-standard.org/standard/core/WHILE#contribution-208 `------------------------------------------ GI5 don't compile correctly. To cope with subsequent test it should be as follow. ``` T{ : GI5 DUP 2 > IF BEGIN DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 THEN ; -> }T ``` ,---------. | Replies | `---------´ ,------------------------------------------ | 2021-08-19 02:27:37 MitraArdron replies: | testcase - More general Testcase | see: https://forth-standard.org/standard/core/DEPTH#reply-712 `------------------------------------------ I hit a similar problem and think it would be better not to depend on START-DEPTH instead ``` T{ DEPTH DEPTH - -> -1 }T T{ DEPTH 0 SWAP DEPTH - -> 0 -1 }T T{ DEPTH 0 1 ROT DEPTH - -> 0 1 -2 }T ``` ,------------------------------------------ | 2021-08-19 13:34:23 MatteoVitturi replies: | testcase - More general Testcase | see: https://forth-standard.org/standard/core/DEPTH#reply-713 `------------------------------------------ @MitraArdron : I agree with you ! I've tried your suggestions and I have to say the last two don't work because the final negative literal is one off. They should be: ``` T{ DEPTH 0 SWAP DEPTH - -> 0 -2 }T T{ DEPTH 0 1 ROT DEPTH - -> 0 1 -3 }T ``` Then, following your method, I would add some more: ``` T{ DEPTH 9 8 -> 9 8 DEPTH 2 - ROT ROT }T T{ DEPTH 9 -> 9 DEPTH 1 - SWAP }T T{ 9 DEPTH -> DEPTH 9 SWAP 1 + }T T{ 9 8 DEPTH -> DEPTH 9 8 ROT 2 + }T ``` ,------------------------------------------ | 2021-08-20 11:25:13 MatteoVitturi replies: | requestClarification - Why "[" is specified using immediacy? | see: https://forth-standard.org/standard/core/Bracket#reply-714 `------------------------------------------ Read it in reverse, [ is the only word this Standard explicitly declares IMMEDIATE  _and_ whose Interpretation semantics are undefined. In this perspective [ is a most peculiar word that cannot be easily compared with other words with undefined interpretation semantics such as IF or others alike because [ is not STATE-dependant like them: in fact it is the opposite i.e. STATE is [-dependant since STATE is modified by  [  independantly from what the current (value of) STATE is. AFAIK there is only one more word this Standard explicitly declares IMMEDIATE i.e. \  the comment till EOL. Both [ and \ (if you want them to perform their duty _and_ you aren't creating some special word) _just cannot_ be compiled and the only way to accpmplish this is having them IMMEDIATE. Having ] undefined interpretation semantics seems a bit misleading but it IMHO means that there is no reason or no useful effect to use it while not compiling. _Matteo_ ,------------------------------------------ | 2021-08-20 21:56:52 MatteoVitturi replies: | comment - There is an error in testing | see: https://forth-standard.org/standard/core/WHILE#reply-715 `------------------------------------------ GI5 don't compile correctly. To cope with subsequent tests it should be as follow. ``` T{ : GI5 DUP 2 > IF BEGIN DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 THEN ; -> }T ```