[plt-scheme] apply

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Mon Jun 22 18:58:34 EDT 2009

Skeptic . wrote:
> Hi,
> (procedure? apply)#t
> (primitive? apply)#f
> How/where is implemented apply in PLT Scheme ?

Here's a procedure that will help you find out:

;; where-defined : identifier -> path or symbol
;; Returns the path of the module where the name is defined
;; or a symbol for a built-in module.
(define (where-defined id)
   (unless (identifier? id)
     (raise-type-error 'where-defined "identifier" id))
   (let ([binding (identifier-binding id)])
     (cond [(list? binding)
             (module-path-index-resolve (car binding)))]
            (raise-syntax-error 'where-defined
                                "not from a module"

(where-defined #'apply)

Seems to be defined in $COLLECTS/scheme/private/pre-base.ss.


Posted on the users mailing list.