Re: Starting Forth, starting out.
- From: John Doty <jpd@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 05 Jan 2006 08:01:37 -0700
Trey Boudreau wrote:
On 2006-01-05, Jerry Avins <jya@xxxxxxxx> wrote:
John Doty wrote:
Jerry Avins wrote:
For one reason, the phrase DEPTH DROP so clearly amounts to a no-op
> ...
Depends on your dialect. In LSE "depth drop iterate" clears the stack! Simpler (but surely stranger ;-) than ANS Forth.
Strange indeed!
start with ( x y z ) DEPTH ( x y z depth ) DROP ( x y z ) ITERATE ?????
Given the descriptions he's provided recently, I'd guess:
ITERATE - super-immediate (via one-token look-ahead). Execute the compilation buffer (or perhaps just the previous token) TOS times.
The hyper-reductionist style of thought required to navigate the interpreter/compiler maze in traditional Forth isn't required for ordinary programming in LSE, so the doc just says:
n action iterate (perform action n times)
Nor does it "execute the compile buffer". The definition:
repent : depth drop iterate
works just like the command "depth drop iterate". Both implementations so far (Bob's old one and my modern one) are merely IMMEDIATE, but that reflects the fact that they are both ITC, so that at compile time "iterate" can just pick up the cell that the compiler made of "drop" and move it into the loop it compiles.
I don't know why Bob did it this way, and I'm seriously considering changing it to:
n iterate action (perform action n times)
---
John Doty, Noqsi Aerospace, Ltd.
---
His diagnosis of the hostility ... reflects the willful blindness of the invader who assures himself that the natives are only made unfriendly by some other provocation than his own. -Barbara W. Tuchman
.
- Follow-Ups:
- Re: Starting Forth, starting out.
- From: jmdrake_98
- Re: Starting Forth, starting out.
- From: Bernd Paysan
- Re: Starting Forth, starting out.
- From: John Passaniti
- Re: Starting Forth, starting out.
- References:
- Starting Forth, starting out.
- From: Colin MacIntyre
- Re: Starting Forth, starting out.
- From: Colin MacIntyre
- Re: Starting Forth, starting out.
- From: Andrew Haley
- Re: Starting Forth, starting out.
- From: Jerry Avins
- Re: Starting Forth, starting out.
- From: Alex McDonald
- Re: Starting Forth, starting out.
- From: Jerry Avins
- Re: Starting Forth, starting out.
- From: John Doty
- Re: Starting Forth, starting out.
- From: Jerry Avins
- Re: Starting Forth, starting out.
- From: Trey Boudreau
- Starting Forth, starting out.
- Prev by Date: Re: Starting Forth, starting out.
- Next by Date: Re: RfD: One-time file loading
- Previous by thread: Re: Starting Forth, starting out.
- Next by thread: Re: Starting Forth, starting out.
- Index(es):
Relevant Pages
|
|