Sujet : Re: Parsing timestamps?
De : minforth (at) *nospam* gmx.net (minforth)
Groupes : comp.lang.forthDate : 23. Jun 2025, 22:03:19
Autres entêtes
Organisation : novaBBS
Message-ID : <a004d0f4acf945e054db77d86a4544fc@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Rocksolid Light
On Mon, 23 Jun 2025 5:18:34 +0000, Anton Ertl wrote:
minforth@gmx.net (minforth) writes:
So, I made me a small extension to the locals word set. Using your
example SPIN (abc — cba), I can define it as follows:
: SPIN { a b c == c b a } ; \ no need for additional code before ;
>
What is the advantage of using this extension over the Forth-2012:
>
: spin {: a b c :} c b a ;
>
?
Obviously, there is no advantage for such small definitions.
For me, the small syntax extension is a convenience when working
with longer definitions. A bit contrived (:= synonym for TO):
: SOME-APP { a f: b c | temp == n: flag z: freq }
\ inputs: integer a, floats b c
\ uninitialized: float temp
\ outputs: integer flag, complex freq
<: FUNC < ... calc function ... > ;>
\ emulated embedded function using { | xt: func }
< ... calc something ... > := temp
< ... calc other things ... > := freq / basic formula
< ... calc other things ... > := flag
< ... calc correction ... > := freq / better estimation
;
While working on such things, I can focus my eyes on the formulas,
all local values are visible in one place, and I don't have to
worry about tracking the data stack(s) for lost/accumulated items.
As I said, it is nothing spectacular, just helpful. And to my own
eyes, it looks neater. ;-)
And before dxf yowls again: it is still Forth. :o)
--