Lu,
There's no switch as such that will do this but it's easy to install a pretty printer that will print ints in hex.
Poly/ML 5.3 Release
> local
    fun prettyInt _ _ x =
      PolyML.PrettyString("0x" ^ Int.fmt StringCvt.HEX x)
in
    val () = PolyML.addPrettyPrinter prettyInt
end;
# # # # > 18;
val it = 0x12 : int
>
You could easily modify this to include your own ref that would allow you to switch the format as you want.

Regards,
David

Lu Zhao wrote:
The problem is that I want to see some intermediate results that are mixed with other data types in tuples. I know I could write wrapper functions converting all intermediate integer results to string, but it's kind of tedious since I need to add that function to everywhere I want to see the hex format. A more desired solution is to turn on some flag, since I basically only need to see the hex format of integers.

Lu

Gergely Buday wrote:
Lu Zhao wrote:

Is there a way to make polyml display an integer in its hex format? For
example,

0x12;
val it = 18 : int

I want to have 0x12 echoed back instead of 18.

I do not know about echoing but you can print integers in hexadecimal
format using

Int.fmt: StringCvt.radix -> int -> string

http://standardml.org/Basis/string-cvt.html#SIG:STRING_CVT.radix:TY

http://standardml.org/Basis/integer.html#SIG:INTEGER.fmt:VAL

e.g.

- Int.fmt StringCvt.HEX 18;
val it = "12" : string

- Gergely
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to