utils: Add sgfy.
This commit is contained in:
parent
8dfa11b17c
commit
3a3c0e2d4d
2 changed files with 7 additions and 1 deletions
|
@ -39,5 +39,8 @@
|
|||
(check-equal? (any->string '(a 1 (x y))) "(a 1 (x y))")
|
||||
(check-equal? (any->string "hello") "hello")
|
||||
(let ([mp (variable-mapping-stringify #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)")))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
(contract-out [variable-mapping? contract?]
|
||||
[string-variable-mapping? contract?])
|
||||
;; Syntax
|
||||
auto-hash-ref/explicit auto-hash-ref/:)
|
||||
auto-hash-ref/explicit auto-hash-ref/: sgfy)
|
||||
|
||||
;;; ===================
|
||||
;;; HashTable Injection
|
||||
|
@ -159,3 +159,6 @@
|
|||
(define (variable-mapping-stringify ht)
|
||||
(make-hash (hash-map ht (λ (key val)
|
||||
(cons key (any->string val))))))
|
||||
|
||||
;;; A shortcut for variable-mapping-stingify.
|
||||
(define-syntax-rule (sgfy ht) (variable-mapping-stringify ht))
|
||||
|
|
Loading…
Reference in a new issue