Re: Naming 'n' instances or repetitions

Liste des GroupesRevenir à cl forth 
Sujet : Re: Naming 'n' instances or repetitions
De : ruvim.pinka (at) *nospam* gmail.com (Ruvim)
Groupes : comp.lang.forth
Date : 24. May 2025, 14:50:41
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <100sirh$lm0v$2@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
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.
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

 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.?
Having `hold ( c -- )`, and `n>r ( +n.len*x +n.len -- )`,
the word `nhold` should have the stack diagram ( +n.len*c +n.len-- ),
that is a pair of a tuple of characters and the tuple length.
So, the phrase:
  'a' 'b' 'c' 3 nhold
should probably be equivalent to:
  'a' 'b' 'c' hold hold hold
or maybe to:
  'a' hold 'b' hold 'c' hold
(the best option should be chosen according to the practice).
In the word `shold`, `s` could indicate the character string data type, that is ( c-addr u ), but this name does not read very well because of the `sh` phoneme.
--
Ruvim

Date Sujet#  Auteur
22 May 25 * Naming 'n' instances or repetitions9dxf
22 May 25 +* Re: Naming 'n' instances or repetitions2Anton Ertl
22 May 25 i`- Re: Naming 'n' instances or repetitions1dxf
23 May 25 +- Re: Naming 'n' instances or repetitions1dxf
23 May 25 +* Re: Naming 'n' instances or repetitions2Hans Bezemer
24 May 25 i`- Re: Naming 'n' instances or repetitions1dxf
24 May 25 `* Re: Naming 'n' instances or repetitions3Ruvim
24 May 25  +- Re: Naming 'n' instances or repetitions1albert
25 May 25  `- Re: Naming 'n' instances or repetitions1dxf

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal