#lang scheme ; What file is a name defined in? ;; definition-source : identifier -> (U symbol path) ;; Returns a symbol or path for the module that contains ;; the definition for a given name. (define (definition-source id) (let ([binding (identifier-binding id)]) (and (list? binding) (resolved-module-path-name (module-path-index-resolve (car binding)))))) (definition-source #'map) ; => #<path:C:\PLT-4.1.5\collects\scheme\private\map.ss> (definition-source #'+) ; => #%kernel ; "The + procedure is defined in the built-in kernel module ; (it has no Scheme source file)." |
(via PLT)
Post a Comment