Changeset 16082 in project


Ignore:
Timestamp:
09/25/09 04:50:09 (10 years ago)
Author:
Kon Lovett
Message:

Exported write/display-list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/srfi-101/trunk/functional-lists.scm

    r16041 r16082  
    7171    ra:list-ref/update
    7272    ra:map
    73     ra:for-each)
     73    ra:for-each
     74    ;;
     75    ra:write-list
     76    ra:display-list)
    7477
    7578  (import scheme
     
    131134  (rest kons-rest))
    132135
    133 (define (ra:write-list kons #!optional (out (current-output-port)))
     136(define (ra:output-list writer kons #!optional (out (current-output-port)))
    134137  (display #\( out)
    135138  (unless (ra:null? kons)
     
    137140      (let-values (((car cdr) (ra:car+cdr kons)))
    138141        (if (ra:pair? car) (display car out)
    139             (write car out) )
     142            (writer car out) )
    140143        (cond ((ra:pair? cdr)
    141144                (display #\space out)
     
    144147                (display #\. out)
    145148                (display #\space out)
    146                 (write cdr) ) ) ) ) )
     149                (writer cdr) ) ) ) ) )
    147150  (display #\) out) )
    148151
     152(define (ra:write-list kons #!optional (out (current-output-port)))
     153  (ra:output-list write kons out) )
     154
    149155(define (ra:display-list kons #!optional (out (current-output-port)))
    150   (display #\( out)
    151   (unless (ra:null? kons)
    152     (let loop ((kons kons))
    153       (let-values (((car cdr) (ra:car+cdr kons)))
    154         (display car out)
    155         (cond ((ra:pair? cdr)
    156                 (display #\space out)
    157                 (loop cdr) )
    158               ((not (ra:null? cdr))
    159                 (display #\. out)
    160                 (display #\space out)
    161                 (display cdr) ) ) ) ) )
    162   (display #\) out) )
     156  (ra:output-list display kons out) )
    163157
    164158(define-record-printer (kons kons out)
Note: See TracChangeset for help on using the changeset viewer.