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

Other miscellaneous stuff

This page is part of the web mail archives of SRFI 41 from before July 7th, 2015. The new archives for SRFI 41 contain all messages, not just those from before July 7th, 2015.


A few notes to add to Andre's:

* Should the library name have a SRFI-nnn prefix?

* The (stream-primitives) library should import (rnrs mutable-pairs) since it
  uses set-car! and set-cdr!.

* The export form in (stream-derived) should be
  (export list-of-exports ...)
  and not
  (export (list of exports ...))

* The code for stream-match-pattern should be:

  (define-syntax stream-match-pattern
    (lambda (x)
      (define (wildcard? x)
        (and (identifier? x)
             (free-identifier=? x #'_)))
      (syntax-case x ()
        ((stream-match-pattern strm () (binding ...) body)
         #'(and (stream-null? strm) (let (binding ...) body)))
        ((stream-match-pattern strm (w? . rest) (binding ...) body)
         (wildcard? #'w?)
         #'(and (stream-pair? strm)
                (let ((strm (stream-cdr strm)))
(stream-match-pattern strm rest (binding ...) body))))
        ((stream-match-pattern strm (var . rest) (binding ...) body)
         #'(and (stream-pair? strm)
(let ((temp (stream-car strm)) (strm (stream-cdr strm))) (stream-match-pattern strm rest ((var temp) binding ...) body))))
        ((stream-match-pattern strm w? (binding ...) body)
         (wildcard? #'w?)
         #'(let (binding ...) body))
        ((stream-match-pattern strm var (binding ...) body)
         #'(let ((var strm) binding ...) body)))))

Do you have any test cases for the two libraries?