Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define reg (make-regexp "[$][{]([[:alnum:]]+)[}]"))
- (define (%xformat str alist)
- (regexp-substitute/global
- #f reg str 'pre
- (lambda (m)
- (or (assq-ref alist (string->symbol (match:substring m 1)))
- (format #f "error:~a" (match:substring m 1))))
- 'post))
- (display (%xformat "${invoice} from ${customer}"
- '((customer . "client") (invoice . "facture"))))
- (newline)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement