add functions

pull/1/head
Matthew Butterick 11 years ago
parent e597ae1e10
commit 250315d09f

@ -17,13 +17,21 @@
(define tags (append block-tags inline-tags)) (define tags (append block-tags inline-tags))
(define/contract (entity->string e)
(symbol? . -> . string?)
(format "~a" (integer->char (entity->integer e))))
(define/contract (string->entity str)
(string? . -> . symbol?)
(integer->entity (char->integer (car (string->list str)))))
(define/contract (entity->integer e) (define/contract (entity->integer e)
(symbol? . -> . integer?) (symbol? . -> . integer?)
(hash-ref entities e)) (hash-ref entities e))
(define/contract (integer->entity c) (define/contract (integer->entity int)
(integer? . -> . symbol?) (integer? . -> . symbol?)
(hash-ref chars c)) (hash-ref chars int))
(define entities '#hash((quot . 34) (define entities '#hash((quot . 34)
(amp . 38) (amp . 38)

Loading…
Cancel
Save