Liste des Groupes | Revenir à cl forth |
In article <nnd$75b7a2a4$616fdd6b@4f60b314ce95c9b9>,<SNIP>
Hans Bezemer <the.beez.speaks@gmail.com> wrote:
Orhttps://www.youtube.com/watch?v=Y7cax2fDS84>
I was impressed with the Behringer solution.
(I didn't care about the politically correct solution.)
>
====================================
: local{ R> SWAP DUP >R @ >R >R ;
: }global R> R> R> ! >R ;
=================
>
But I can do you one better.
Remember the word ;: from colorforth. That is actually a coroutine call.
I call it CO. (Present in ciforth since the year 00)
>
An example of its use is the following:
:NONAME .S ; ' LIST decorated
decorated is not the point. The noname decorates LIST with
the anonymous function, so that the stack is printed, before LIST.
Now we go one step further:
:NONAME .S CO ." AFTER " .S ; ' LIST decorated
The noname decorates LIST with the anonymous function, so that the
stack is printed, before, but now noname is suspended, LIST is
executed as a coroutine, and afterword the stack is printed once more.
>
With CO the example become
---------------------------------------
: LOCAL R> SWAP DUP >R @ >R >R CO R> R> ! ;
>
VARIABLE A
VARIABLE B
>
: divide
A LOCAL
B LOCAL
B ! A ! A @ B @ /
. CR
;
>
15 3 divide
---------------------------------------
Groetjes Albert--
Les messages affichés proviennent d'usenet.