In DX-Forth I have:
NHOLD (H.N)
On 2025-05-22 07:34, dxf wrote:
I've noticed two ways of naming things 'done n times'.
In SwiftForth there is:
(.0) (H.0)
which equate to executing '#' 'n' times.
It's not clear to me why '0' was used though '0' appears in forth naming
conventions meaning 'initialization'.
In VFX Forth (and perhaps others) there is:
NDROP
where 'n' indicates number of executions.
In the word names like `ndrop`, `n>r`, `nr>` I consider `n` as an
indicator of the data type on which these words operate.
Namely, it is an indicator of the data type ( +n.len*x +n.len ), that is
a dependent pair type.
Other examples.
In the words like `2swap`, `2>r`, `2drop`, `2!`, etc, `2` is an
indicator of the data type ( 2*x ), that is an unspecified pair ( x x ).
But in the word `2/` (and non-standard `2+`), `2` is not a data type >indicator. Therefore, this name conflicts and is best avoided/eliminated.2/ is misleading because is is not the same as 2 / .
In the words like `u/`, `umin`, `umax`, etc, `u` is an indicator of the
data type ( u ), that is unsigned single-cell integer number.
In the words like `d+`, `dnegate`, etc, `d` is an indicator of the data
type ( d ), that is signed double-cell integer number.
See more at https://github.com/ForthHub/discussion/discussions/186
--
Ruvim
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 505 |
Nodes: | 16 (0 / 16) |
Uptime: | 70:44:02 |
Calls: | 9,927 |
Calls today: | 3 |
Files: | 13,807 |
Messages: | 6,347,005 |
Posted today: | 2 |