Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: melahi_ahmed@yahoo.fr (ahmed) Newsgroups: comp.lang.forth Subject: Re: Back & Forth - Co-routines Date: Fri, 31 Jan 2025 23:05:15 +0000 Organization: novaBBS Message-ID: References: <9c16141dfe3c785e316678770e965566@www.novabbs.com> <87plk2y6yf.fsf@nightsong.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="2092604"; mail-complaints-to="usenet@i2pn2.org"; posting-account="t+/9LUKLIiUqIe6reyFE7me/EcA/Gr17dRXgwnADesE"; User-Agent: Rocksolid Light X-Spam-Checker-Version: SpamAssassin 4.0.0 X-Rslight-Site: $2y$10$1kkK5R78ny2u2E6FzPAwHel1YH/xM/0hI.nGZF9O./N1u1beHAAke X-Rslight-Posting-User: 5f6b2e70af503e44dad56966aa15d35bdef29623 Bytes: 1657 Lines: 23 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 --