Keep track of last displayed value.

This commit is contained in:
Dominik Pantůček 2023-03-30 21:15:00 +02:00
parent 08e305bd5b
commit ca1270d7ae
4 changed files with 34 additions and 17 deletions

View file

@ -85,8 +85,19 @@
(let* ((separator (get-keyword #:separator args (lambda () ";")))
(string-delimiter (get-keyword #:string-delimiter args (lambda () "\"")))
(lines (read-lines (open-input-file fn)))
(csv-parse-line (make-csv-line-parser separator string-delimiter)))
(map csv-parse-line lines)))
(csv-parse-line (make-csv-line-parser separator string-delimiter))
(total (max (sub1 (length lines)) 1)))
(let loop ((lines lines)
(idx 0)
(res '()))
(if (null? lines)
(reverse res)
(let ((line (car lines)))
(progress%-advance (/ idx total))
(loop (cdr lines)
(add1 idx)
(cons (csv-parse-line line)
res)))))))
;; Splits CSV into header and body based on the first empty row.
(define (csv-split-header csv)