Closed rachitnigam closed 3 years ago
If I understand what you want to do correctly, one easy hack is to write it as a string, read it back as an S-exp, and then use racket/pretty
to format it.
(define (convert obj)
(pretty-format (read (open-input-string (~a result)))))
Okay, that's helpful. Is there no standard way to convert an ite
into a cond
or something? I can implement something that does it but it'll be some work.
I don't think we have anything like that.
But also note that ite
is already a callable function if you are willing to (require rosette/base/core/polymorphic)
(which is Rosette internals, so you might or might not want to use it, depending on your use case)
Is there a library function to pretty print
ite
expressions generated from symbolic execution? I want to store the results of symbolically evaluating program as golden outputs in my repository so that future changes to the internals of my system don't affect the generated representation.I have something like:
I would like to print it in human readable form, ideally similar to Racket's
cond
form: