[plt-scheme] top-level error

From: Day (day7195891 at gmail.com)
Date: Wed May 9 04:59:04 EDT 2007


    I am really confused that why DrSchme complains that:

BUG  reference to undefined identifier: make-stack

for the code below when i click "Run"

(define aim-cell-stk (make-stack))

(define make-stack
  (lambda ()
    (let ((ls '()))
      (lambda (msg . entries)
          ((eqv? msg 'empty?)
           (null? ls))
          ((eqv? msg 'push!)
           (set! ls (cons (car entries) ls)))
          ((eqv? msg 'top)
           (car ls))
          ((eqv? msg 'pop!)
           (set! ls (cdr ls)))
           "Oops, invalid message!"))))))

Both are in the top-level environment, why the complaint?

Posted on the users mailing list.