Sujet : Re: Back & Forth - Co-routines
De : no.email (at) *nospam* nospam.invalid (Paul Rubin)
Groupes : comp.lang.forthDate : 31. Jan 2025, 23:06:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87plk2y6yf.fsf@nightsong.com>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
melahi_ahmed@yahoo.fr (ahmed) writes:
: tri_mf3 ( x a b c -- mf) { a b c -- } \ locals à la gforth
dup a < if drop 0 exit then
dup a >= over b < and if a - 100 b a - */ exit then
dup b >= over c < and if c swap - 100 c b - */ exit then
drop 0
;
This seems more in the locals spirit:
: blend { a x b -- n } 100 b x - b a - */ ;
: tri_mf3.1 { x a b c -- mf }
a x <= x b < AND IF b x a blend EXIT THEN
b x <= x c < AND IF b x c blend EXIT THEN
0 ;