[plt-scheme] attempt to discern applications from syntactic forms fails

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Jan 15 12:40:36 EST 2009

My question is at the <===== in the following code:

(define-syntax (x stx)
 (syntax-case stx ()
  ((_ x)
   (let ((y (expand-once #'x)))
    (printf "~s~n" (syntax->datum y))
    (syntax-case y (#%app)
     ((#%app . z) #''app)
     (_ #''no-app))))))

(x (let ((a 1)) a))
; printed: (let-values (((a) 1)) a)
; value: no-app, ok
(x (list 1 2 3))
; printed (#%app list 1 2 3)
; value: no-app, why??? <===== I expected app
(x list)
; printed: list
; value: no-app, ok

Thanks, Jos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090115/d1ae0420/attachment.html>

Posted on the users mailing list.