utils: Remove sgfy.
This commit is contained in:
parent
87dc89ee6f
commit
8bc2a582a6
3 changed files with 2 additions and 8 deletions
|
@ -152,7 +152,7 @@
|
||||||
converts all the values of a given variable mapping to strings:
|
converts all the values of a given variable mapping to strings:
|
||||||
|
|
||||||
#+BEGIN_SRC racket :results table drawer
|
#+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
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
|
|
|
@ -41,9 +41,6 @@
|
||||||
(let ([mp (stringify-variable-mapping #hash((a . (and a b)) (b . (not b))))])
|
(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 'a) "(and a b)")
|
||||||
(check-equal? (hash-ref mp 'b) "(not 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 "(or b (not a))") '(or b (not a)))
|
||||||
(check-equal? (string->any "14") 14)
|
(check-equal? (string->any "14") 14)
|
||||||
(check-equal? (read-org-sexp "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")
|
(check-equal? (read-org-sexp "((\"a\" \"(and a b)\") (\"b\" \"(or b (not a))\"))")
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
[string-variable-mapping? contract?]
|
[string-variable-mapping? contract?]
|
||||||
[general-pair/c (-> contract? contract? contract?)])
|
[general-pair/c (-> contract? contract? contract?)])
|
||||||
;; Syntax
|
;; Syntax
|
||||||
auto-hash-ref/explicit auto-hash-ref/: sgfy unorg dotit)
|
auto-hash-ref/explicit auto-hash-ref/: unorg dotit)
|
||||||
|
|
||||||
;;; ===================
|
;;; ===================
|
||||||
;;; HashTable Injection
|
;;; HashTable Injection
|
||||||
|
@ -190,9 +190,6 @@
|
||||||
(define (stringify-variable-mapping ht)
|
(define (stringify-variable-mapping ht)
|
||||||
(for/hash ([(key val) ht]) (values key (any->string val))))
|
(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.
|
;;; Reads any value from string.
|
||||||
(define (string->any str)
|
(define (string->any str)
|
||||||
(with-input-from-string str (λ () (read))))
|
(with-input-from-string str (λ () (read))))
|
||||||
|
|
Loading…
Reference in a new issue