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

Re: where define is legal



>> 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 suspect you get an unbound global variable error, correct?

What about the following, slightly different definition for "foo"?

(define (foo bool)
  (define (result)
    (if bool
        #t
        #f))
   (result))

eric