/usr/share/racket/collects/syntax/strip-context.rkt is in racket-common 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #lang racket/base
(require unstable/struct)
(provide strip-context
replace-context)
(define (strip-context e)
(replace-context #f e))
(define (replace-context ctx e)
(cond
[(syntax? e)
(datum->syntax ctx
(replace-context ctx (syntax-e e))
e
e)]
[(pair? e) (cons (replace-context ctx (car e))
(replace-context ctx (cdr e)))]
[(vector? e) (list->vector
(map (lambda (e) (replace-context ctx e))
(vector->list e)))]
[(box? e) (box (replace-context ctx (unbox e)))]
[(prefab-struct-key e)
=> (lambda (k)
(apply make-prefab-struct
k
(replace-context ctx (struct->list e))))]
[else e]))
|