Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
|
|
@ -0,0 +1,17 @@
|
|||
#lang racket
|
||||
(require (planet neil/csv:1:=7) net/url)
|
||||
|
||||
(define make-reader
|
||||
(make-csv-reader-maker
|
||||
'((separator-chars #\,)
|
||||
(strip-leading-whitespace? . #t)
|
||||
(strip-trailing-whitespace? . #t))))
|
||||
|
||||
(define (all-rows port)
|
||||
(define read-row (make-reader port))
|
||||
(define head (append (read-row) '("SUM")))
|
||||
(define rows (for/list ([row (in-producer read-row '())])
|
||||
(define xs (map string->number row))
|
||||
(append row (list (~a (apply + xs))))))
|
||||
(define (->string row) (string-join row "," #:after-last "\n"))
|
||||
(string-append* (map ->string (cons head rows))))
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
(define csv-file
|
||||
"C1, C2, C3, C4, C5
|
||||
1, 5, 9, 13, 17
|
||||
2, 6, 10, 14, 18
|
||||
3, 7, 11, 15, 19
|
||||
4, 8, 12, 16, 20")
|
||||
|
||||
(display (all-rows (open-input-string csv-file)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue