unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Fwd: Re: definition in expression context, where definitions are not allowed
@ 2015-10-11 17:14 Arne Babenhauserheide
  0 siblings, 0 replies; only message in thread
From: Arne Babenhauserheide @ 2015-10-11 17:14 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

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 #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 299 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-11 17:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-11 17:14 Fwd: Re: definition in expression context, where definitions are not allowed Arne Babenhauserheide

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