On 05/03/2016 17:16, David Topham wrote:
I am looking for a way to display the code as well as the output when
running SML.
e.g.

fun f x = x * x;
f 4;
just displays
val it = 16: int

and I would like something like:

f 4 = 16
or similar to see what code was evaluated to get the 16

The only thing that occurs to me is to turn on "parsetree" debugging with PolyML.Compiler.parsetree := true; The output is pretty-printed into a form very similar to the original.

> PolyML.Compiler.parsetree := true;
val it = (): unit
> fun f x = x * x;
fun f x = x * x
val f = fn: int -> int
> f 4;
val it = f 4
val it = 16: int
>

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

Reply via email to