You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/restructure/pointer.rkt

20 lines
611 B
Racket

8 years ago
#lang br
(define the-ks (make-hash))
(define xs (make-hash))
(define is '(a b (c . h) d e f g h i j))
(for ([(v i) (in-indexed is)]
#:unless (hash-has-key? xs i))
(report* xs i)
(hash-set! xs i
(let/cc k
(let ([v (cond
[(pair? v) (hash-set! the-ks (cdr v) k) (car v)]
[else v])])
(define tk (hash-ref the-ks v #f))
(cond
[tk
(hash-remove! the-ks v)
(tk (format "~a xref" v))]
[else (format "just ~a" v)])))))