In section 16.1.3 of the Racket Guide there is this example and explanation: ----------------------------- (define-syntax clock (syntax-id-rules (set!) [(set! clock e) (put-clock! e)] [(clock a ...) ((get-clock) a ...)] [clock (get-clock)]))
(define-values (get-clock put-clock!) (let ([private-clock 0]) (values (lambda () private-clock) (lambda (v) (set! private-clock v))))) The (clock a ...) pattern is needed because, when an identifier macro is used after an open parenthesis, the macro transformer is given the whole form, like with a non-identifier macro. ------------------------------------------------------- If I run this in DrRacket and then type in the evaluation window: > (clock) It fails with "procedure application: expected procedure, given: 0 (no arguments)" as it should. If I now remove the line in the macro " [(clock a ...) ((get-clock) a ...)]" then entering:either clock or (clock) at the evaluation prompt returns 0. Why is it that (clock) doesn't still fail with "procedure application: expected procedure, given: 0 (no arguments)" . I.e. doesn't it expand to ((get-clock)). Thanks, Harry ____________________ Racket Users list: http://lists.racket-lang.org/users