unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Keith Wright <kwright@free-comp-shop.com>
Cc: guile-user@gnu.org
Subject: Re: extending FEM enginering package with Guile
Date: Thu, 8 Jan 2004 17:13:12 -0500	[thread overview]
Message-ID: <200401082213.i08MDCLU002090@fcs10.free-comp-shop.com> (raw)
In-Reply-To: <m3d69vvuuq.fsf@multivac.cwru.edu> (prj@po.cwru.edu)

> From: prj@po.cwru.edu (Paul Jarc)
> 
> Keith Wright <kwright@free-comp-shop.com> 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


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  reply	other threads:[~2004-01-08 22:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 19:20 extending FEM enginering package with Guile Mario Storti
2004-01-05 20:26 ` Paul Jarc
2004-01-05 21:32 ` Ken Anderson
2004-01-05 22:04 ` rm
2004-01-08  4:58 ` Keith Wright
2004-01-08  6:04   ` Paul Jarc
2004-01-08 22:13     ` Keith Wright [this message]
2004-01-09 21:31     ` Keith Wright
  -- strict thread matches above, loose matches on Subject: below --
2004-01-06 19:35 Mario Storti
2004-01-06 22:31 ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200401082213.i08MDCLU002090@fcs10.free-comp-shop.com \
    --to=kwright@free-comp-shop.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).