utils: Add unorg.
This commit is contained in:
parent
ea77374933
commit
576f204846
2 changed files with 9 additions and 3 deletions
|
@ -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)))))
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue