[plt-scheme] Error in match or error in me?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed Mar 17 13:36:00 EDT 2010

When I run this:

--
#lang scheme

(define-match-expander const
  (syntax-rules ()
    [(_ v p ...)
     (app (lambda _ v) p ...)]))
(define-match-expander xexpr
  (syntax-rules ()
    [(_ tag attrs body ...)
     (list-rest
      tag
      (or
       ; If there are attributes it's easy, we just need to ensure
they are attributes
       (list (and (attributes _ (... ...))
                  attrs)
             body ...)
       ; If not
       (and
        ; we have to make sure empty attrs are allowed
        (const empty attrs)
        ; and ensure we aren't missing attrs,
        (or (list)
            (list-rest (not (attributes _ (... ...)))
                       _))
        ; then continue
        (list body ...))))]))
(define-match-expander attributes
  (syntax-rules ()
    [(_ attrp ...)
     (and (list (attr _ _) (... ...))
          (list-no-order attrp ...))]))
(define-match-expander attr
  (syntax-rules ()
    [(_ key value)
     (list (? symbol? key)
           (? string? value))]))

(match `(ul . behavior)
  [(xexpr tag attrs body ...)
   (list tag attrs body)])
--

I get the error:

context (lexical binding) expected 3 values, received 1 value: #f

and a bizarre trace inside match. Is this an error of me or match?

Jay


-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.