[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(match ...) error inside (define-syntax ...)

From: Tentaclius
Subject: (match ...) error inside (define-syntax ...)
Date: Tue, 15 Jun 2010 12:53:50 +0300

Hi all,

I met this problem when having some experiments with define-syntax.
Just cannot understand what I do wrong.

(define-syntax test
  (syntax-rules ()
      (lambda args
        (match args
               ('a (display "Test:a\n"))
               ('b (display "Test:b\n"))
               ('c (display "Test:c\n"))
               (_  (display "Unknown message\n")) ) ))))

(define t (test))
(t 'a)

This is a simplified part of the code. Executing this leads to following error

In unknown file:
   ?: 0* [t a]
   ?: 1  (if (equal? args (quote a)) ((lambda () (display "Test:a
"))) ...)
   ?: 2* [equal? ...

<unnamed port>: While evaluating arguments to equal? in _expression_ (equal? args (quote a)):
<unnamed port>: Unbound variable: args
ABORT: (unbound-variable)

with guile-1.8.7, and to

Throw to key `unbound-variable':
ERROR: In procedure module-lookup:
ERROR: Unbound variable: args
Entering the debugger. Type `bt' for a backtrace or `c' to continue.

with guile-1.9.11.

Does it mean I cannot use (match ...) within macro-definition?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]