Package "srfi40"


Version:
v1.0.3
Released:
2463 days ago
Maintainer:
Tony Sidaway <tonysidaway@gmail.com
Author:
Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway
Homepage:
http://srfi.schemers.org/srfi-40/
Description:
A Library of Streams
Keywords:
srfi
Package form:
(package*
 srfi40/v1.0.3
 (provide:
  (define (stream-error message) (snow-error message))
  (define-record* stream-rec promise)
  (define (make-stream promise) (make-stream-rec promise))
  (define (stream? obj) (stream-rec? obj))
  (define (stream-promise r) (stream-rec-promise r))
  (define (stream-promise-set! r v) (stream-rec-promise-set! r v))
  (define (box x) (vector x))
  (define (unbox s) (vector-ref s 0))
  (define (set-box! s v) (vector-set! s 0 v))
  (cond-expand
   ((or chicken guile)
    (define-macro (stream-low-level-lazy exp)
      `(vector (cons 'suspension (lambda () ,exp))))
    (define-macro (stream-low-level-delay exp)
      `(stream-low-level-lazy (stream-low-level-strict ,exp)))
    (define-macro (stream-cons obj strm)
      (let ((strm-val (gensym)))
        `(make-stream
          (stream-low-level-delay
           (let ((,strm-val ,strm))
             (if (not (stream? ,strm-val))
                 (stream-error "attempt to stream-cons onto non-stream")
                 (cons ,obj ,strm-val)))))))
    (define-macro (stream-delay exp)
      `(make-stream (stream-low-level-lazy ,exp))))
   (else (define-syntax
          stream-low-level-lazy
          (syntax-rules
           ()
           ((stream-low-level-lazy exp)
            (vector (cons 'suspension (lambda () exp))))))
         (define-syntax
          stream-low-level-delay
          (syntax-rules
           ()
           ((stream-low-level-delay exp)
            (stream-low-level-lazy (stream-low-level-strict exp)))))
         (define-syntax
          stream-cons
          (syntax-rules
           ()
           ((stream-cons obj strm)
            (make-stream
             (stream-low-level-delay
              (let ((strm-val strm))
                (if (not (stream? strm-val))
                    (stream-error "attempt to stream-cons onto non-stream")
                    (cons obj strm-val))))))))
         (define-syntax
          stream-delay
          (syntax-rules
           ()
           ((stream-delay exp) (make-stream (stream-low-level-lazy exp)))))))
  (define (stream-low-level-strict x) (make-stream (vector (cons 'value x))))
  (define (stream-low-level-force promise))
  (define (stream-null))
  (define (stream-null? obj)
    (and (stream? obj) (null? (stream-low-level-force obj))))
  (define (stream-pair? obj)
    (and (stream? obj) (not (null? (stream-low-level-force obj)))))
  (define (stream-car strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-car of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-car of null stream"))
          (else (car (stream-low-level-force strm)))))
  (define (stream-cdr strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-cdr of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-cdr of null stream"))
          (else (cdr (stream-low-level-force strm)))))
  (define (stream . objs)
    (let loop ((objs objs))
      (stream-delay
       (if (null? objs)
           stream-null
           (stream-cons (car objs) (loop (cdr objs)))))))
  (define (stream-unfoldn gen seed n))
  (define (stream-map func . strms))
  (define (stream-for-each proc . strms))
  (define (stream-filter pred? strm)))
 (maintainer: "Tony Sidaway <tonysidaway@gmail.com")
 (author:
  "Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway")
 (description: "A Library of Streams")
 (homepage: "http://srfi.schemers.org/srfi-40/")
 (keywords: srfi)
 (license: "MIT"))

Version:
v1.0.2
Released:
2463 days ago
Maintainer:
Tony Sidaway <tonysidaway@gmail.com
Author:
Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway
Homepage:
http://srfi.schemers.org/srfi-40/
Description:
A Library of Streams
Keywords:
srfi
Package form:
(package*
 srfi40/v1.0.2
 (provide:
  (define (stream-error message) (snow-error message))
  (define-record* stream-rec promise)
  (define (make-stream promise) (make-stream-rec promise))
  (define (stream? obj) (stream-rec? obj))
  (define (stream-promise r) (stream-rec-promise r))
  (define (stream-promise-set! r v) (stream-rec-promise-set! r v))
  (define (box x) (vector x))
  (define (unbox s) (vector-ref s 0))
  (define (set-box! s v) (vector-set! s 0 v))
  (cond-expand
   (chicken (define-macro (stream-low-level-lazy exp)
              `(vector (cons 'suspension (lambda () ,exp))))
            (define-macro (stream-low-level-delay exp)
              `(stream-low-level-lazy (stream-low-level-strict ,exp)))
            (define-macro (stream-cons obj strm)
              (let ((strm-val (gensym)))
                `(make-stream
                  (stream-low-level-delay
                   (let ((,strm-val ,strm))
                     (if (not (stream? ,strm-val))
                         (stream-error
                          "attempt to stream-cons onto non-stream")
                         (cons ,obj ,strm-val)))))))
            (define-macro (stream-delay exp)
              `(make-stream (stream-low-level-lazy ,exp))))
   (else (define-syntax
          stream-low-level-lazy
          (syntax-rules
           ()
           ((stream-low-level-lazy exp)
            (vector (cons 'suspension (lambda () exp))))))
         (define-syntax
          stream-low-level-delay
          (syntax-rules
           ()
           ((stream-low-level-delay exp)
            (stream-low-level-lazy (stream-low-level-strict exp)))))
         (define-syntax
          stream-cons
          (syntax-rules
           ()
           ((stream-cons obj strm)
            (make-stream
             (stream-low-level-delay
              (let ((strm-val strm))
                (if (not (stream? strm-val))
                    (stream-error "attempt to stream-cons onto non-stream")
                    (cons obj strm-val))))))))
         (define-syntax
          stream-delay
          (syntax-rules
           ()
           ((stream-delay exp) (make-stream (stream-low-level-lazy exp)))))))
  (define (stream-low-level-strict x) (make-stream (vector (cons 'value x))))
  (define (stream-low-level-force promise))
  (define (stream-null))
  (define (stream-null? obj)
    (and (stream? obj) (null? (stream-low-level-force obj))))
  (define (stream-pair? obj)
    (and (stream? obj) (not (null? (stream-low-level-force obj)))))
  (define (stream-car strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-car of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-car of null stream"))
          (else (car (stream-low-level-force strm)))))
  (define (stream-cdr strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-cdr of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-cdr of null stream"))
          (else (cdr (stream-low-level-force strm)))))
  (define (stream . objs)
    (let loop ((objs objs))
      (stream-delay
       (if (null? objs)
           stream-null
           (stream-cons (car objs) (loop (cdr objs)))))))
  (define (stream-unfoldn gen seed n))
  (define (stream-map func . strms))
  (define (stream-for-each proc . strms))
  (define (stream-filter pred? strm)))
 (maintainer: "Tony Sidaway <tonysidaway@gmail.com")
 (author:
  "Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway")
 (description: "A Library of Streams")
 (homepage: "http://srfi.schemers.org/srfi-40/")
 (keywords: srfi)
 (license: "MIT"))

Version:
v1.0.1
Released:
2464 days ago
Maintainer:
Tony Sidaway <tonysidaway@gmail.com
Author:
Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway
Homepage:
http://srfi.schemers.org/srfi-40/
Description:
A Library of Streams
Keywords:
srfi
Package form:
(package*
 srfi40/v1.0.1
 (provide:
  (define (stream-error message) (snow-error message))
  (define-record* stream-rec promise)
  (define (make-stream promise) (make-stream-rec promise))
  (define (stream? obj) (stream-rec? obj))
  (define (stream-promise r) (stream-rec-promise r))
  (define (stream-promise-set! r v) (stream-rec-promise-set! r v))
  (define (box x) (vector x))
  (define (unbox s) (vector-ref s 0))
  (define (set-box! s v) (vector-set! s 0 v))
  (define-macro (stream-low-level-lazy exp)
    `(vector (cons 'suspension (lambda () ,exp))))
  (define-macro (stream-low-level-delay exp)
    `(stream-low-level-lazy (stream-low-level-strict ,exp)))
  (define-macro (stream-cons obj strm)
    (let ((strm-val (gensym)))
      `(make-stream
        (stream-low-level-delay
         (let ((,strm-val ,strm))
           (if (not (stream? ,strm-val))
               (stream-error "attempt to stream-cons onto non-stream")
               (cons ,obj ,strm-val)))))))
  (define-macro (stream-delay exp) `(make-stream (stream-low-level-lazy ,exp)))
  (define (stream-low-level-strict x) (make-stream (vector (cons 'value x))))
  (define (stream-low-level-force promise))
  (define (stream-null))
  (define (stream-null? obj)
    (and (stream? obj) (null? (stream-low-level-force obj))))
  (define (stream-pair? obj)
    (and (stream? obj) (not (null? (stream-low-level-force obj)))))
  (define (stream-car strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-car of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-car of null stream"))
          (else (car (stream-low-level-force strm)))))
  (define (stream-cdr strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-cdr of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-cdr of null stream"))
          (else (cdr (stream-low-level-force strm)))))
  (define (stream . objs)
    (let loop ((objs objs))
      (stream-delay
       (if (null? objs)
           stream-null
           (stream-cons (car objs) (loop (cdr objs)))))))
  (define (stream-unfoldn gen seed n))
  (define (stream-map func . strms))
  (define (stream-for-each proc . strms))
  (define (stream-filter pred? strm)))
 (maintainer: "Tony Sidaway <tonysidaway@gmail.com")
 (author:
  "Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway")
 (description: "A Library of Streams")
 (homepage: "http://srfi.schemers.org/srfi-40/")
 (keywords: srfi)
 (license: "MIT"))

Version:
v1.0.0
Released:
2464 days ago
Maintainer:
Tony Sidaway <tonysidaway@gmail.com
Author:
Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway
Homepage:
http://srfi.schemers.org/srfi-40/
Description:
A Library of Streams
Keywords:
srfi
Package form:
(package*
 srfi40/v1.0.0
 (provide:
  (define (stream-error message) (snow-error message))
  (define-record* stream promise)
  (define (box x) (vector x))
  (define (unbox s) (vector-ref s 0))
  (define (set-box! s v) (vector-set! s 0 v))
  (define-macro (stream-low-level-lazy exp)
    `(vector (cons 'suspension (lambda () ,exp))))
  (define-macro (stream-low-level-delay exp)
    `(stream-low-level-lazy (stream-low-level-strict ,exp)))
  (define-macro (stream-cons obj strm)
    (let ((strm-val (gensym)))
      `(make-stream
        (stream-low-level-delay
         (let ((,strm-val ,strm))
           (if (not (stream? ,strm-val))
               (stream-error "attempt to stream-cons onto non-stream")
               (cons ,obj ,strm-val)))))))
  (define-macro (stream-delay exp) `(make-stream (stream-low-level-lazy ,exp)))
  (define (stream-low-level-strict x) (make-stream (vector (cons 'value x))))
  (define (stream-low-level-force promise))
  (define stream-null)
  (define (stream-null? obj)
    (and (stream? obj) (null? (stream-low-level-force obj))))
  (define (stream-pair? obj)
    (and (stream? obj) (not (null? (stream-low-level-force obj)))))
  (define (stream-car strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-car of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-car of null stream"))
          (else (car (stream-low-level-force strm)))))
  (define (stream-cdr strm)
    (cond ((not (stream? strm))
           (stream-error "attempt to take stream-cdr of non-stream"))
          ((stream-null? strm)
           (stream-error "attempt to take stream-cdr of null stream"))
          (else (cdr (stream-low-level-force strm)))))
  (define (stream . objs)
    (let loop ((objs objs))
      (stream-delay
       (if (null? objs)
           stream-null
           (stream-cons (car objs) (loop (cdr objs)))))))
  (define (stream-unfoldn gen seed n))
  (define (stream-map func . strms))
  (define (stream-for-each proc . strms))
  (define (stream-filter pred? strm)))
 (maintainer: "Tony Sidaway <tonysidaway@gmail.com")
 (author:
  "Philip L. Bewig, Andre von Tonder and catfive/chaosnet.org, adapted Tony Sidaway")
 (description: "A Library of Streams")
 (homepage: "http://srfi.schemers.org/srfi-40/")
 (keywords: srfi)
 (license: "MIT"))