Sujet : Re: Back & Forth - Co-routines
De : melahi_ahmed (at) *nospam* yahoo.fr (ahmed)
Groupes : comp.lang.forthDate : 01. Feb 2025, 00:05:15
Autres entêtes
Organisation : novaBBS
Message-ID : <bd580f4ed3fccbf685ac1955fcdcd356@www.novabbs.com>
References : 1 2 3
User-Agent : Rocksolid Light
On Fri, 31 Jan 2025 22:06:00 +0000, Paul Rubin wrote:
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 ;
Yes, thanks.
I know that with a little bit of thinking one can get good solutions.
Ahmed
--