Sujet : Re: Naming 'n' instances or repetitions
De : the.beez.speaks (at) *nospam* gmail.com (Hans Bezemer)
Groupes : comp.lang.forthDate : 23. May 2025, 12:45:38
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$26a91801$7a2db6c0@f68bf40b4b8d025f>
References : 1
User-Agent : Mozilla Thunderbird
On 22-05-2025 05: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 DX-Forth I have:
NHOLD (H.N)
mainly because I couldn't think of anything else but willing to change
if there were a consensus.
Does anyone have knowledge on the matter or conventions etc.?
I consulted "Thinking Forth", but there's nothing directly relevant there. What I *DO* tend to do is to take a hash (#) as an indicator for "number". It can be positional (ERROR#), quantum (#ELEMENTS) - unless it is a quantum "per" thing (/ELEMENT).
It has to be a "fixed" quantum though. E.g. if there was no such thing as LEAVE or UNLOOP, I'd have no problems using a word like #DO - and something like #MOVE or #FILL wouldn't get any criticism from me too.
So, if I'd have to drop a number of elements I'd call it #DROP. The problem I have with "N" as a prefix is that it might be confusing. E.g. NEAT is a boolean for something cool - or the number of times something is eaten?
Hans Bezemer