From dbfa5600811efb0ce4025fd95770b8f4dd776810 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Mon, 2 Mar 2020 18:42:54 +0100 Subject: [PATCH] utils: read-org-table -> read-org-sexp. --- utils-tests.rkt | 2 +- utils.rkt | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utils-tests.rkt b/utils-tests.rkt index 945c74e..dd46c80 100644 --- a/utils-tests.rkt +++ b/utils-tests.rkt @@ -46,7 +46,7 @@ (check-equal? (hash-ref mp 'b) "(not b)")) (check-equal? (string->any "(or b (not a))") '(or b (not a))) (check-equal? (string->any "14") 14) - (check-equal? (read-org-table "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))") + (check-equal? (read-org-sexp "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))") '(("a" "(and a b)") ("b" "(or b (not a))"))) (check-equal? (unstringify-pairs '(("a" . "1") ("b" . "(and a (not b))"))) '((a . 1) (b . (and a (not b))))) diff --git a/utils.rkt b/utils.rkt index 490cad7..94a8c8e 100644 --- a/utils.rkt +++ b/utils.rkt @@ -15,7 +15,7 @@ [any->string (-> any/c string?)] [stringify-variable-mapping (-> variable-mapping? string-variable-mapping?)] [string->any (-> string? any/c)] - [read-org-table (-> string? (listof any/c))] + [read-org-sexp (-> string? (listof any/c))] [unstringify-pairs (-> (listof (general-pair/c string? any/c)) (listof (general-pair/c symbol? any/c)))] [read-org-variable-mapping (-> string? variable-mapping?)] @@ -183,9 +183,9 @@ (define (string->any str) (with-input-from-string str (λ () (read)))) -;;; Reads a table from a string produced by Org-mode for a named -;;; table. See example.org for examples. -(define (read-org-table str) (string->any str)) +;;; Reads a sexp from a string produced by Org-mode for a named table. +;;; See example.org for examples. +(define (read-org-sexp str) (string->any str)) ;;; A contract allowing pairs constructed via cons or via list. (define (general-pair/c key-contract val-contract) @@ -211,7 +211,7 @@ ;;; Reads a variable mapping from a string, such as the one which ;;; Org-mode produces from tables. (define (read-org-variable-mapping str) - (make-hash (unstringify-pairs (read-org-table str)))) + (make-hash (unstringify-pairs (read-org-sexp str)))) ;;; A synonym for read-org-variable-mapping. (define-syntax-rule (unorg str) (read-org-variable-mapping str))