utils.rkt: Add handle-org-booleans.
This commit is contained in:
parent
54905071d7
commit
e3efbb8f65
1 changed files with 14 additions and 0 deletions
14
utils.rkt
14
utils.rkt
|
@ -160,3 +160,17 @@
|
|||
(test-case "string->any"
|
||||
(check-equal? (string->any "(or b (not a))") '(or b (not a)))
|
||||
(check-equal? (string->any "14") 14)))
|
||||
|
||||
;;; Given a sexp, converts all "#f" to #f and "#t" to #t.
|
||||
;;;
|
||||
;;; When I read Org-mode tables, I pump them through a call to the
|
||||
;;; prin1 because the elisp sexp seems incompatible with Racket. On
|
||||
;;; the other hand, Racket Booleans seem to upset elisp a little, so
|
||||
;;; prin1 wraps them in additional double quotes. This function
|
||||
;;; removes those quotes.
|
||||
(: handle-org-booleans (-> Any Any))
|
||||
(define/match (handle-org-booleans datum)
|
||||
[("#t") #t]
|
||||
[("#f") #f]
|
||||
[((? list?)) (map handle-org-booleans datum)]
|
||||
[ (_) datum])
|
||||
|
|
Loading…
Reference in a new issue