make read-csv-file/rows available in BSL; closes PR 13542
This commit is contained in:
parent
09f9f31213
commit
200c20967d
|
@ -53,11 +53,6 @@
|
||||||
;; -- f must be formated as a a file with comma-separated values (Any)
|
;; -- f must be formated as a a file with comma-separated values (Any)
|
||||||
;; read the specified file as a list of lists---one per line---of values (Any)
|
;; read the specified file as a list of lists---one per line---of values (Any)
|
||||||
|
|
||||||
read-csv-file/rows ;; String ([Listof Any] -> X) -> [Listof X]
|
|
||||||
;; -- f must be formated as a a file with comma-separated values (Any)
|
|
||||||
;; read the specified file as a file of comma-separated values, apply the second
|
|
||||||
;; argument to each row, i.e., list of CSV on one line
|
|
||||||
|
|
||||||
write-file ;; String String -> String
|
write-file ;; String String -> String
|
||||||
;; (write-file filename str) writes str to filename;
|
;; (write-file filename str) writes str to filename;
|
||||||
;; produces the file name as a confirmation that the write succeeded
|
;; produces the file name as a confirmation that the write succeeded
|
||||||
|
@ -66,6 +61,13 @@
|
||||||
;; *output-devives*: symbols that redirect output from a output-port
|
;; *output-devives*: symbols that redirect output from a output-port
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(provide-higher-order-primitive
|
||||||
|
read-csv-file/rows (_ row-processor) ;; String ([Listof Any] -> X) -> [Listof X]
|
||||||
|
;; -- f must be formated as a a file with comma-separated values (Any)
|
||||||
|
;; read the specified file as a file of comma-separated values, apply the second
|
||||||
|
;; argument to each row, i.e., list of CSV on one line
|
||||||
|
)
|
||||||
|
|
||||||
;; -----------------------------------------------------------------------------
|
;; -----------------------------------------------------------------------------
|
||||||
|
|
||||||
(define-syntax-rule
|
(define-syntax-rule
|
||||||
|
|
6
collects/2htdp/tests/batch-io-csv-ho.rkt
Normal file
6
collects/2htdp/tests/batch-io-csv-ho.rkt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
;; The first three lines of this file were inserted by DrRacket. They record metadata
|
||||||
|
;; about the language level of this file in a form that our tools can easily process.
|
||||||
|
#reader(lib "htdp-beginner-reader.ss" "lang")((modname read-with-csv-ho) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
|
||||||
|
(require 2htdp/batch-io)
|
||||||
|
|
||||||
|
(check-expect (read-csv-file/rows "batch-io-csv-ho.rktl" length) (cons 3 empty))
|
1
collects/2htdp/tests/batch-io-csv-ho.rktl
Normal file
1
collects/2htdp/tests/batch-io-csv-ho.rktl
Normal file
|
@ -0,0 +1 @@
|
||||||
|
a,b,c
|
|
@ -17,6 +17,7 @@ run error-in-draw.rkt
|
||||||
run -t batch-io.rkt
|
run -t batch-io.rkt
|
||||||
run -t batch-io2.rkt
|
run -t batch-io2.rkt
|
||||||
run -t batch-io3.rkt
|
run -t batch-io3.rkt
|
||||||
|
run -t batch-io-csv-ho.rkt
|
||||||
run clause-once.rkt
|
run clause-once.rkt
|
||||||
run full-scene-visible.rkt
|
run full-scene-visible.rkt
|
||||||
run image-too-large.rkt
|
run image-too-large.rkt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user