utils: Remove sgfy.

This commit is contained in:
Sergiu Ivanov 2020-03-24 23:47:20 +01:00
parent 87dc89ee6f
commit 8bc2a582a6
3 changed files with 2 additions and 8 deletions

View file

@ -152,7 +152,7 @@
converts all the values of a given variable mapping to strings:
#+BEGIN_SRC racket :results table drawer
(sgfy #hash((a . (and a b)) (b . (not b))))
(stringify-variable-mapping #hash((a . (and a b)) (b . (not b))))
#+END_SRC
#+RESULTS:

View file

@ -41,9 +41,6 @@
(let ([mp (stringify-variable-mapping #hash((a . (and a b)) (b . (not b))))])
(check-equal? (hash-ref mp 'a) "(and a b)")
(check-equal? (hash-ref mp 'b) "(not b)"))
(let ([mp (sgfy #hash((a . (and a b)) (b . (not b))))])
(check-equal? (hash-ref mp 'a) "(and a b)")
(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-sexp "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")

View file

@ -48,7 +48,7 @@
[string-variable-mapping? contract?]
[general-pair/c (-> contract? contract? contract?)])
;; Syntax
auto-hash-ref/explicit auto-hash-ref/: sgfy unorg dotit)
auto-hash-ref/explicit auto-hash-ref/: unorg dotit)
;;; ===================
;;; HashTable Injection
@ -190,9 +190,6 @@
(define (stringify-variable-mapping ht)
(for/hash ([(key val) ht]) (values key (any->string val))))
;;; A shortcut for variable-mapping-stingify.
(define-syntax-rule (sgfy ht) (stringify-variable-mapping ht))
;;; Reads any value from string.
(define (string->any str)
(with-input-from-string str (λ () (read))))