On Fri, 2009-09-25 at 18:12 -0500, Eduardo Cavazos wrote:
> If anybody has something like this, lemme know!

Just to chime-in with an example of how my (xitomatl match) library
could do it:

  (import (xitomatl match))

  (define-syntax lambda/match
    (lambda (stx)
      (syntax-case stx ()
        ((_ (pat ...) . body)
         (with-syntax
             (((t ...) (generate-temporaries (syntax (pat ...)))))
           (syntax
            (let ((m (match-lambda
                       (#(pat ...)
                        (let () . body)))))
              (lambda (t ...)
                (m (vector t ...))))))))))

  (define-record-type thing (fields a b))

  (define foo
    (lambda/match (((quote literal) x y)
                   ((:record thing a b) ...)
                   #(z))
      (values x y a b z)))
  
(foo (list (quote literal) 1 2)
     (list (make-thing 3 4) (make-thing 5 6))
     (vector 7))
=>
1
2
(3 5)
(4 6)
7


-- 
: Derick
----------------------------------------------------------------

Reply via email to