unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: prj@po.cwru.edu (Paul Jarc)
Cc: guile-user@gnu.org
Subject: Re: extending FEM enginering package with Guile
Date: Thu, 08 Jan 2004 01:04:39 -0500	[thread overview]
Message-ID: <m3d69vvuuq.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <200401080458.i084wPKw002504@fcs10.free-comp-shop.com>

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)))))

I'm not sure what you mean by your "end-of-loop = continue" comment.
If you mean that falling through to the end of the let body will
result in another loop iteration, then that's wrong.  If you mean that
an explicit call to loop will result in another loop iteration, then
that's right.  But if anything appears after it - i.e., if it's not in
tail position - then the result of the inner call won't be passed back
as the result of the outer computation.


paul


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


  reply	other threads:[~2004-01-08  6:04 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 [this message]
2004-01-08 22:13     ` Keith Wright
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=m3d69vvuuq.fsf@multivac.cwru.edu \
    --to=prj@po.cwru.edu \
    --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).