use 'any for read-line, closes PR11445
This commit is contained in:
parent
39008f2130
commit
4af96aaa1c
|
@ -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
|
||||
|
||||
|
|
17
collects/2htdp/tests/batch-io2.rkt
Normal file
17
collects/2htdp/tests/batch-io2.rkt
Normal 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")
|
||||
|
||||
|
||||
|
1
collects/2htdp/tests/batch-io2.txt
Normal file
1
collects/2htdp/tests/batch-io2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
hello
|
Loading…
Reference in New Issue
Block a user