use 'any for read-line, closes PR11445

This commit is contained in:
Matthias Felleisen 2010-12-05 12:15:20 -05:00
parent 39008f2130
commit 4af96aaa1c
3 changed files with 23 additions and 2 deletions

View File

@ -63,7 +63,7 @@
(map string (read-chunks f read-char drop-last-newline)))
(def-reader (read-lines f)
(read-chunks f read-line reverse))
(read-chunks f *read-line reverse))
(def-reader (read-words f)
(read-words/line/internal f append))
@ -74,7 +74,7 @@
(read-words/line/internal f cons))
(define (read-words/line/internal f combine)
(define lines (read-chunks f read-line (lambda (x) x)))
(define lines (read-chunks f *read-line (lambda (x) x)))
(foldl (lambda (f r)
(define fst (filter (compose not (curry string=? "")) (split f)))
(combine fst r))
@ -87,6 +87,9 @@
(check-proc 'read-csv-file row 1 "one argument" "row")
(read-csv-file/func f row))
(define (*read-line)
(read-line (current-input-port) 'any))
;; -----------------------------------------------------------------------------
;; tester

View File

@ -0,0 +1,17 @@
#lang racket
;; test for pr11445
(require 2htdp/batch-io)
(with-output-to-file "batch-io2.txt"
(lambda ()
(display "hello")
(display #\return)
(display #\linefeed))
#:exists 'replace)
(read-lines "batch-io2.txt")

View File

@ -0,0 +1 @@
hello