guile-user
[Top][All Lists]
Advanced

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

Re: loop translations (was: Re: language translator help)


From: Marius Vollmer
Subject: Re: loop translations (was: Re: language translator help)
Date: 28 Apr 2002 20:15:26 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"John W. Eaton" <address@hidden> writes:

> On 28-Apr-2002, Marius Vollmer <address@hidden> wrote:
> 
> | "John W. Eaton" <address@hidden> writes:
> |
> | Your approach is essentially right.  Let me try to formalize it a bit
> | with some macros:
> 
> Thanks.  With the macros, the loops are much more readable to me, but
> there is still the (apparent, at least to a Scheme novice) complexity
> of call/cc.

Yes, but I think it is properly encapsulated with 'with-exit'.

> | The problem with the macros above is that they are not hygienic,
> 
> Sorry, I'm not sure I understand what that means.

They can shadow identifiers from the user.  Code like

    (let ((continue #t))
      (while continue
        (set! continue #f)))

wont work since the 'continue' identifier inside the while does not
refer to the one introduced by the let.  A good solution would be to
make the continue feature optional and let the user choose the name of
the function.  Much like 'with-exit', where the name of the exiting
function is determined by the user, not the macro.

> | avoiding call/cc is not so easy and is hopefully
> | not really necessary.  One could generate continuation-passing code
> | and hope that Guile will execute it more efficiently than the
> | occasional call/cc,
> 
> What is continuation passing?

Start here:

    http://www.scheme.com/tspl2d/further.html#g1849

> It's important to me that looping not be any slower than it already is
> in Octave.

I'd say you should first do the simple thing (using call/cc) and later
worry about performance.



reply via email to

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