Hi!

The current psyntax in Guile does not support tail patterns; for
example, here's a syntax-rules implementation of SRFI-34 `guard', using
this feature:

(define-syntax guard
  (syntax-rules (else)
    ((guard (var (clauses ... (else default))) body0 body ...)
     (catch throw-key
            (lambda ()
              body0 body ...)
            (lambda (key var)
              (cond clauses ...))))
    ((guard (var (clauses ...)) body0 body ...)
     (guard (var (clauses ... (else (throw key var))))
       body0 body ...))))

Note that after the ellipses, there may be extra clauses ("tail
patterns"). This is not valid by R5RS, but mandated by R6RS[0]. It would
be cool if support for this feature could be added to Guile. I tried, a
while ago, to add the support to psyntax (going by the newest version of
it[1]), but was defeated by boostrapping issues.

[0] http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_sec_11.19
[1] http://ikarus-scheme.org/r6rs-libraries/

Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>


Reply via email to