Re: acceptance of forth



Marcel Hendrix <mhx@xxxxxx> wrote:

tinkerer@xxxxxxxxxxxxxxx (Tinkerer Atlarge) writes Re: acceptance of forth

Stephen Pelc <stephenXXX@xxxxxxxxxxxx> wrote:

On Sun, 29 Nov 2009 00:32:01 +1000, tinkerer@xxxxxxxxxxxxxxx (Tinkerer
Atlarge) wrote:
You have basically three choices as in any language:

[order of choices switched]

2) test at the bottom
begin
<action>
<test>
until

Realizing its similarity to the "goto" loop was my breakthrough in
appreciating how simple 'begin:until' is beneath the surface.

Can you remember what you thought before the breakthrough?

I didn't think anything about it because, prior to that, it had nothing
to differentiate itself in my mind from other constructs also starting
with BEGIN. Keeping my finger on the page while I copied it into the
computer was the only way I could be sure I didn't accidentally switch
templates halfway through.

What I am talking about has as much to do with how to make these things
stick in our minds as how they work.

With "until" I always have the problem remembering if it continues
when <test> is TRUE, or when <test> is FALSE.

You're way ahead of me if you can remember that much about it.

1) test at the top
begin
<test>
while
<action>
repeat

One of my recurring frustrations when learning forth was repeatedly (and
I felt undeservedly) finding myself painted into a corner. The symptoms
were that the going kept getting unaccountably harder, the further I
proceeded along a certain path. It was like I had unwittingly taken a
wrong turn which I could only realize further down the track. The "wrong
turn" had no symptoms of its own. However, if I had made a mistake
anywhere, that is where it happened.

Although this reads very nicely and heightens the user's anticipation of
revelation to almost unbearable heights, I still do not quite grasp what
you mean by this. My hypothesis is that you think new users may interpret
the construct as testing once, before entering an infinite loop (i.e.
repeat jumps to after while instead of after begin?)

I haven't had a chance to form such an opinion yet. I was responding
positively to the clarity of Stephen's template as instantly conveying
what I assumed was its meaning. However, on consulting other books and
looking back over the source code which is the most accurate record of
my forth learning experience, I now see that

1) begin..while..repeat has multiple templates (which, overlooked as it
was, might be enough to account for my confusion)

2) the way I have used it myself is more lilke a FOR loop where the body
leads up to the test, all within the <test> section. All I have used the
<action> part for is to increment a count. The secret might be to forget
about constructs and consider the action of WHILE and REPEAT as entities
in their own right which only need BEGIN as an end-marker for their own
purposes. But that is just me thinking aloud. I don't claim to know yet.

To understand where I am coming from you need to visualize the
circumstances where I consulted the books. The first time I read them in
genuine book-reading mode. The Loops section came up, full of
hard-to-remember detail, right at the end of my attention span.

In subsequent readings I was using them as reference books, trying to
find the appropriate looping construct for what I needed as quickly as
possible. (All languages I have used in the past have them, and I have
never had difficulty finding the right one before). If I had someone
there to tell me which one to use I would gladly have taken their word
for it without being distracted by their theoretical implications.

Although your analogies are very nice, like other readers of this thread
I am dying to hear some concrete examples. Please!

That will take a bit more time as I have a lot of code to sift through
first. I will try to answer it in another post.
.



Relevant Pages

  • Re: I need lessons specific to PLLs.
    ... The problem is choosing the parameters for the loop filter ... According to a couple of books on GPS, ... Loop filters for timing recovery, in particular, can get tricky, because ...
    (comp.dsp)
  • I need lessons specific to PLLs.
    ... I am a computer science student who knows a bit about DSP that I learned ... The problem is choosing the parameters for the loop filter and the science ... According to a couple of books on GPS, a second order filter with transfer ...
    (comp.dsp)
  • Re: A Class of Non-Halting TMs
    ... >> Step, current state, input, and tape position. ... and so it will loop forever" may not be true. ... if you take a nonhalting machine history which eventually ... My method will say steps 7-8 repeat: ...
    (comp.theory)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... > break out early and use the loop variable. ... of a C++ compiler via templates", that allows a C++ programmer to do many ... idiom is built into Ada, Eiffel, etc. via constraint genericity, ... and so doesn't require a "template computing compiler" for constraining. ...
    (comp.lang.ada)
  • Re: Teaching new tricks to an old dog (C++ -->Ada)
    ... > break out early and use the loop variable. ... of a C++ compiler via templates", that allows a C++ programmer to do many ... idiom is built into Ada, Eiffel, etc. via constraint genericity, ... and so doesn't require a "template computing compiler" for constraining. ...
    (comp.lang.cpp)