guile-devel
[Top][All Lists]
Advanced

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

Fwd: Re: definition in expression context, where definitions are not all


From: Arne Babenhauserheide
Subject: Fwd: Re: definition in expression context, where definitions are not allowed
Date: Sun, 11 Oct 2015 19:14:54 +0200
User-agent: KMail/4.14.8 (Linux/3.14.14-gentoo; KDE/4.14.8; x86_64; ; )

Hi David,

Thank you for answering!

May I send my reply to guile-devel?

Am Sonntag, 11. Oktober 2015, 09:58:59 schrieb David Kastrup:
> > Or am I missing something else which is enabled by this limitation?
> 
> A function defined with `define' may call a function defined in a
> _following_ `define'.  How do you make that work when a statement
> in-between can already call the first function?

So this is a guarantee that all defines in a block of defines can call
each other?

I now looked it up in r7rs small.[1]

> Definitions can occur at the beginning of a body (that
> is, the body of a lambda, let, let*, letrec, letrec*,
> let-values, let*-values, let-syntax, letrec-syntax,
> parameterize, guard, or case-lambda).

> An expanded body containing internal definitions can al-
> ways be converted into a completely equivalent letrec*
> expression.

So essentially this is just explicit scoping, as with let. And let
proved to me that it works better than just assigning anywhere
(because it doesn’t have a large overhead).

So I think what threw me off is mainly the error message: 

> definition in expression context, where definitions are not allowed

This does not tell me how I can do what I intended to. “all
definitions must be at the beginning of the body. You can for example
create a new scope with let ().”

Best wishes,
Arne

[1]: http://trac.sacrideo.us/wg/wiki/R7RSHomePage
     http://trac.sacrideo.us/wg/raw-attachment/wiki/WikiStart/r7rs.pdf
     5.3.2, page 26

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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