(module stream-type mzscheme ;; This hides the implementation of the stream type. The library is ;; in stream.ss (require (lib "lazy.ss" "srfi" "45")) ;; avoid conflicts (provide (all-defined) s:force s:delay lazy) ;; Constructors (define @null (s:delay '())) (define-syntax @cons (syntax-rules () ((_ a b) (s:delay (cons a b))))) ;; Primitive accessors (define (@car x) (car (s:force x))) (define (@cdr x) (cdr (s:force x))) ;; Primitive predicates. (define (@pair? x) (and (srfi-45-promise? x) (pair? x))) (define (@null? x) (and (srfi-45-promise? x) (null? (s:force x)))) (define (@list? x) (and (srfi-45-promise? x) (or (pair? x) (null? x)))) )