#lang scheme

(define-for-syntax (rebuild stx)
  (if (syntax->list stx)
      (let* ([certifier   (syntax-local-certifier)]
             [introducer  (make-syntax-introducer)]
             [certify     (λ (s) (certifier s #f introducer))]
             [stx  (introducer (syntax-local-introduce stx))]
             [stx  (datum->syntax stx (map certify (syntax->list stx)))]
             [stx  (syntax-local-introduce (introducer stx))])
        (certify stx))
      stx))

(define-syntax (expandify stx)
  (syntax-case stx ()
    [(_ e)  (rebuild (local-expand #'e (syntax-local-context) #f))]))

(define x 10)
(define-syntax-rule (get-two-xs) (list x x))

(provide expandify get-two-xs)
