Sujet : Re: Back & Forth - Co-routines
De : melahi_ahmed (at) *nospam* yahoo.fr (ahmed)
Groupes : comp.lang.forthDate : 31. Jan 2025, 16:35:40
Autres entêtes
Organisation : novaBBS
Message-ID : <eaa1c8156ac813f30dd6c69a62089385@www.novabbs.com>
References : 1 2 3
User-Agent : Rocksolid Light
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
--