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

Re: where define is legal

In article <8904201554.AA13117@spt.entity.com> alms@spt.entity.COM (andrew lm shalit) writes:

   Offhand, the following definition seems bogus:

   (define (foo bool)
     (if bool
	 (define (result) #true)
	 (define (result) #false))

   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.

See section 5.2. Definitions:
"Definitions are valid in some, but not all, contexts where
expressions are. The are vlid only at the top level of a <program>
and, in some implementations, at the beginning of a <body>. [that is,
the body of a lambda, let, let*, letrec or define expression (from 5.2.2)]"


Pertti Kellom\"aki (TeX format)  #   pk@tut.fi   #     Wasting time is
  Tampere Univ. of Technology    #               #    an important part
      Software Systems Lab       #               #        of living