Taken from the paper Invertible Syntax Descriptions: Unifying Parsing and Pretty Printing, this paper implements reversible functions.
> (defvar parser (make-isomorphism #'read-from-string #'write-to-string))
PARSER
> (funcall parser "42")
42
> (unfuncall parser *)
"42"
It provides functions MAKE-ISOMORPHISM
and MAKE-AUTOMORPHISM
, as well as a number of operators for manipulating them, such as INVERSE
.