functions: read-tbfs → lists-tbfs.

This commit is contained in:
Sergiu Ivanov 2020-07-14 23:41:55 +02:00
parent bf45cf6382
commit 45e4feaee0

View File

@ -35,7 +35,7 @@
[apply-tbf (-> tbf? (vectorof (or/c 0 1)) (or/c 0 1))]
[apply-tbf/boolean (-> tbf? (vectorof boolean?) boolean?)]
[list->tbf (-> (cons/c number? (cons/c number? (listof number?))) tbf?)]
[read-tbfs (-> (listof (listof number?)) (listof tbf?))]
[lists->tbfs (-> (listof (listof number?)) (listof tbf?))]
[read-org-tbfs (->* (string?) (#:headers boolean?) (listof tbf?))]
[tbf-tabulate* (-> (listof tbf?) (listof (listof (or/c 0 1))))]
[tbf-tabulate (-> tbf? (listof (listof (or/c 0 1))))]
@ -303,11 +303,11 @@
;;; Reads a list of TBF from an Org-mode table read by
;;; read-org-sexp.
(define read-tbfs ((curry map) list->tbf))
(define lists->tbfs ((curry map) list->tbf))
(module+ test
(test-case "read-tbfs"
(check-equal? (read-tbfs '((1 2 3) (2 3 4)))
(check-equal? (lists->tbfs '((1 2 3) (2 3 4)))
(list (tbf '#(1 2) 3) (tbf '#(2 3) 4)))))
;;; Reads a list of TBF from an Org-mode string containing a sexp,
@ -319,7 +319,7 @@
(define (read-org-tbfs str #:headers [headers #f])
(define sexp (read-org-sexp str))
(define sexp-clean (cond [headers (cdr sexp)] [else sexp]))
(read-tbfs sexp-clean))
(lists->tbfs sexp-clean))
(module+ test
(test-case "read-org-tbfs"