Path: utzoo!utgpu!watmath!iuvax!chaynes From: chaynes@iuvax.cs.indiana.edu (Chris Haynes) Newsgroups: comp.lang.scheme Subject: Re: where define is legal Message-ID: Date: 21 Apr 89 07:57:25 GMT References: <8904201554.AA13117@spt.entity.com> Sender: chaynes@iuvax.cs.indiana.edu Organization: Indiana University Lines: 25 In-reply-to: alms@spt.entity.COM's message of 20 Apr 89 19:54:43 GMT Offhand, the following definition seems bogus: (define (foo bool) (if bool (define (result) #true) (define (result) #false)) (result)) And indeed, when I try to run this in MacScheme, I get an error message. I agree with the semantics, but I couldn't find anything in the R3 description of DEFINE which restricts where it may appear. Some people from non-scheme backgrounds might think programmatic DEFINEs perfectly reasonable, so it's probably worth mentioning the restriction in the language description. In R4 and the Standard draft, section 5.2 on definitions begins: Definitions are valid in some, but not all, contexts where expressions are allowed. They are valid only at the top level of a and at the beginning of a . This makes the above example syntactically bogus.