guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extending FEM enginering package with Guile


From: Keith Wright
Subject: Re: extending FEM enginering package with Guile
Date: Thu, 8 Jan 2004 17:13:12 -0500

> From: address@hidden (Paul Jarc)
> 
> Keith Wright <address@hidden> wrote:
> > Don't use while in the first place.  Use "named LET".  Then BREAK
> > is just computing the final answer, and "continue" is calling
> > the named LET procedure.
> 
> Only if the final answer (or call to the named let) appears in tail
> position.
> 
> > (let loop ([var1 init1]
> >            [var2 init2])
> >   (if (cond1) (compute answer))
> >   ; ...
> >   (if (cond2) (loop (new-var1) (new-var2)))
> >   ; ...
> >   (loop (new-var1) (new-var2))  ; end-of-loop = continue
> > )
> 
> This is an infinite loop.  Maybe you meant:
> 
> (let loop ((var1 init1)
>            (var2 init2))
>   (cond
>    ((cond1) (compute answer))
>    ((cond2) (loop (new-var1) (new-var2)))
>    (else    (loop (new-var1) (new-var2)))))

Ooops!  Yes, that's what I meant.  I meant it so much that I
had written a reply claiming that it is the same as what I said
before I noticed the difference.  All the IF's in my program
should have BEGIN's in the else part that contain all following
code.

> I'm not sure what you mean by your "end-of-loop = continue" comment.

I meant that a WHILE loop may have CONTINUE at the end without
changing the meaning, because the bottom of the loop is an implicit
continue.  With named LET you must explicitly write that CONTINUE,
because it does not continue to loop when it hits the bottom.
("Bottom" is a better word than "end" for that point in the code,
because "end" could be taken to mean "finish of execution").

> If you mean that falling through to the end of the let body will
> result in another loop iteration, then that's wrong.

I meant the exact opposite of that wrong statement.

    -- Keith




reply via email to

[Prev in Thread] Current Thread [Next in Thread]