sml - Output is truncated with #-signs in the REPL -
i wrote function works expected don't understand why output that.
function:
datatype prop = atom of string | not of prop | , of prop*prop | or of prop*prop; (* xor = (a , not b) or (not or b) *) local fun do_xor (alpha,beta) = or( and( alpha, not(beta) ), or(not(alpha), beta)) in fun xor (alpha,beta) = do_xor(alpha,beta); end;
test:
val result = xor(atom "a",atom "b");
output:
val result = or (and (atom #,not #),or (not #,atom #)) : prop
this output restriction (yes, it's confusing) - default depth of value printouts in top-level (interactive shell) limited small number (i.e. 5). skipped parts printed #.
you can override depth - @ least, in sml-nj - printdepth variable:
control.print.printdepth := 1024;
p.s. way, don't need separate do_xor , local function here - just
fun xor(alpha, beta) = or(...);
will do.
Comments
Post a Comment