diff --git a/utils-tests.rkt b/utils-tests.rkt index 2bc3839..a2e2954 100644 --- a/utils-tests.rkt +++ b/utils-tests.rkt @@ -51,8 +51,11 @@ (check-equal? (unstringify-pairs '(("a" . "1") ("b" . "(and a (not b))"))) '((a . 1) (b . (and a (not b))))) (let ([m1 (read-org-variable-mapping "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")] - [m2 (read-org-variable-mapping "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")]) + [m2 (read-org-variable-mapping "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")] + [m3 (unorg "((\"a\" . \"(and a b)\") (\"b\" . \"(or b (not a))\"))")]) (check-equal? (hash-ref m1 'a) '(and a b)) (check-equal? (hash-ref m2 'a) '(and a b)) + (check-equal? (hash-ref m3 'a) '(and a b)) (check-equal? (hash-ref m1 'b) '(or b (not a))) - (check-equal? (hash-ref m2 'b) '(or b (not a))))) + (check-equal? (hash-ref m2 'b) '(or b (not a))) + (check-equal? (hash-ref m3 'b) '(or b (not a))))) diff --git a/utils.rkt b/utils.rkt index a346926..f7c11a4 100644 --- a/utils.rkt +++ b/utils.rkt @@ -23,7 +23,7 @@ [string-variable-mapping? contract?] [general-pair/c (-> contract? contract? contract?)]) ;; Syntax - auto-hash-ref/explicit auto-hash-ref/: sgfy) + auto-hash-ref/explicit auto-hash-ref/: sgfy unorg) ;;; =================== ;;; HashTable Injection @@ -197,3 +197,6 @@ ;;; Org-mode produces from tables. (define (read-org-variable-mapping str) (make-hash (unstringify-pairs (read-org-table str)))) + +;;; A synonym for read-org-variable-mapping. +(define-syntax-rule (unorg str) (read-org-variable-mapping str))