unstable/syntax: added explode-module-path-index

This commit is contained in:
Ryan Culpepper 2011-05-11 00:45:30 -06:00
parent dc0138bcb7
commit 56bb28dfc6
2 changed files with 26 additions and 2 deletions

View File

@ -18,6 +18,20 @@
@unstable[@author+email["Ryan Culpepper" "ryanc@racket-lang.org"]]
@defproc[(explode-module-path-index [mpi module-path-index?])
(listof (or/c module-path? resolved-module-path? #f))]{
Unfolds @racket[mpi] using @racket[module-path-index-split], returning
a list of the relative module paths together with the terminal
resolved module path or @racket[#f] for the ``self'' module.
@examples[#:eval the-eval
(explode-module-path-index (car (identifier-binding #'lambda)))
(explode-module-path-index (caddr (identifier-binding #'lambda)))
(explode-module-path-index (car (identifier-binding #'define-values)))
]
}
@;{----}
@margin-note{This binding was added by Vincent St-Amour.}

View File

@ -7,13 +7,14 @@
syntax-list
;; by cce:
syntax-source-file-name
syntax-source-directory
;; by stamourv:
format-unique-id
format-unique-id)
;; by ryanc
explode-module-path-index)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@ -60,3 +61,12 @@
((make-syntax-introducer) (apply format-id
lctx #:source src #:props props #:cert cert
fmt args)))
;; by ryanc
(define (explode-module-path-index mpi)
(let-values ([(x y) (module-path-index-split mpi)])
(cons x
(if (module-path-index? y)
(explode-module-path-index y)
(list y)))))