According to the docs [1]:

> (let ([x 5]) (+ x 6))
> 
> Combining the lexical information from 'let' in the program above to 'x would 
> not produce an identifier that is `free-identifier=?` to either 'x', since it 
> does not appear in the scope of the 'x' binding.

If so, then what is the flaw in the program below, which is intended to test 
this proposition? `free-identifier=?` comes out false only when the new 
identifier has a different name.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#lang racket
(require rackunit)

(define stx #'(let ([x 5]) (+ x 6)))

(define (syntax-flatten stx)
  (flatten
   (let loop ([stx stx])
     (define stxs (syntax->list stx))
     (if stxs
         (map loop stxs)
         stx))))

(define stxs (syntax-flatten stx))
(define stx-let (first stxs))
(define stx-x1 (second stxs))
(define stx-x2 (fifth stxs))

;; these will fail
(check-false (free-identifier=? (datum->syntax stx-let 'x) stx-x1))
(check-false (free-identifier=? (datum->syntax stx-let 'x) stx-x2))

;; but these will succeed
(check-false (free-identifier=? (datum->syntax stx-let 'xxx) stx-x1))
(check-false (free-identifier=? (datum->syntax stx-let 'xxx) stx-x2))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




[1] http://docs.racket-lang.org/reference/syntax-model.html#%28part._id-model%29

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to