Changeset 12518 in project


Ignore:
Timestamp:
11/15/08 18:19:09 (11 years ago)
Author:
azul
Message:

Add stream->string-safe, string->stream-safe and stream-wrap-proc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/stream-ext/trunk/stream-ext.scm

    r1047 r12518  
    9292(define stream->symbol (compose string->symbol stream->string))
    9393(define symbol->stream (compose string->stream symbol->string))
     94
     95(define (stream->string-safe obj)
     96  (if (stream? obj)
     97    (stream->string obj)
     98    obj))
     99
     100(define (string->stream-safe obj)
     101  (if (string? obj)
     102    (string->stream obj)
     103    obj))
     104
     105(define (stream-wrap-proc proc)
     106  (lambda args
     107    (receive results
     108             (apply proc (map stream->string-safe args))
     109      (apply values (map string->stream-safe results)))))
    94110
    95111(define stream-downcase (cut stream-map char-downcase <>))
Note: See TracChangeset for help on using the changeset viewer.