private/free-vars.ss
(module free-vars mzscheme
  ;; this finds the free variables of fully-expanded mzscheme forms + typechecker private forms
  
  (require "planet-requires.ss")
  (require-libs)
  
  
  (define fv
    (kernel-syntax-case* form #f 
                         (define-type-alias-internal define-typed-struct-internal require/typed-internal
                           letrec-syntaxes+values)
      [(if e1 e2 e3) (set:union (fv #'e1) (fv #'e2) (fv #'e3))]
      [(if e1 e2) (set:union (fv #'e1) (fv #'e2))]
      [(#%app es ...) (apply set:union (map fv (syntax->list #'(es ...))))]
      [(lambda vs . body) (set:subtract (apply))])
  
  )