Path: ...!eternal-september.org!feeder3.eternal-september.org!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 15:35:40 +0000 Organization: novaBBS Message-ID: References: <9c16141dfe3c785e316678770e965566@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: i2pn2.org; logging-data="2040623"; 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$ofRiYIQUWeTw9woldFjqg.FA8AiH.N4/QYGRixsdh4tOJaugkZgja X-Rslight-Posting-User: 5f6b2e70af503e44dad56966aa15d35bdef29623 Bytes: 2739 Lines: 55 On Fri, 31 Jan 2025 14:55:05 +0000, Hans Bezemer wrote: > On 31-01-2025 13:45, ahmed wrote: >> Hi, >> Thanks for this video and this implementation of locals. > You're welcome. ... >> Any explainations? > > Yeah, I understand why you like locals, because your stack juggling > skills need some polishing. But I got a video on that: > https://youtu.be/gfE8arB3uWk > I'm still learning and I don't prefer locals or any other method. I just use what it comes handy. And yes, I like stack juggling, but I'm not very skilled for. > First the preliminaries: > > : ;then postpone exit postpone then ; immediate > : >zero dup xor ; > : spin swap rot ; > > These are 4tH-ese, but I'm attached to them. ;-) > ( n1 n2 n3 n4 -- n5) > : calc - >r - 100 r> spin */ ; > > : tri_mf4 > >r rot r> swap >r spin ( c b a R: x ) > dup r@ >= if drop drop >zero rdrop ;then > over r@ >= over r@ < and if dup r> swap calc ;then drop > over r@ >= over r@ < and if over r> calc ;then > rdrop drop >zero > ; > This one (tri_mf5) gives better result and thanks for it. I find: ' tri_mf1 is tri_mf timer-reset 1000000 test .elapsed 88.759600ms ok ' tri_mf2 is tri_mf timer-reset 1000000 test .elapsed 100.902500ms ok ' tri_mf3 is tri_mf timer-reset 1000000 test .elapsed 86.124300ms ok ' tri_mf4 is tri_mf timer-reset 1000000 test .elapsed 209.688300ms ok ' tri_mf5 is tri_mf timer-reset 1000000 test .elapsed 96.897100ms ok > If you need more speed, inline CALC. > BTW, replace "RDROP" with "R> DROP" if you need to. > > Hans Bezemer Thanks for your reply and the way to speedup the method. I'll use it, be sure. Ahmed --