guile-devel
[Top][All Lists]
Advanced

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

Feature request: psyntax tail patterns


From: Andreas Rottmann
Subject: Feature request: psyntax tail patterns
Date: Mon, 05 Oct 2009 15:50:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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

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