Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output is truncated with #-signs in the REPL

Tags:

sml

smlnj

I wrote a function which works as expected but i don't understand why the output is like that.

Function:

datatype prop = Atom of string | Not of prop | And of prop*prop | Or of prop*prop;


(* XOR = (A And Not B) OR (Not A 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
like image 817
tech-ref Avatar asked Dec 25 '10 23:12

tech-ref


People also ask

What is truncated output?

To truncate is to shorten by cutting off. In computer terms, when information is truncated, it is ended abruptly at a certain spot. For example, if a program truncates a field containing the value of pi (3.14159265...) at four decimal places, the field would show 3.1415 as an answer.

How do I export PowerShell to excel?

As of now, there is no built-in command like CSV (Export-CSV) to export output to the excel file but we can use the Out-File command to export data to excel or any other file format. Let's use Out-File to export the output of the Get-Processes command to an excel file.

What is Format wide in PowerShell?

The Format-Wide cmdlet formats objects as a wide table that displays only one property of each object. You can use the Property parameter to determine which property is displayed.

What is FormatEnumerationLimit?

Summary. The $FormatEnumerationLimit variable is a neat feature of PowerShell that allows you to see more occurrences when using Format-Table . But remember: if you are using this variable in a function or a script, you should be aware of the scoping issue.


1 Answers

This is just an output restriction (yes, it's confusing) - by default the depth of value printouts in the top-level (interactive shell) is limited to a fairly small number (i.e. 5). The skipped parts are printed with #.

You can override this depth - at least, in SML-NJ - with printDepth variable:

Control.Print.printDepth := 1024;

P.S. By the way, you don't need a separate do_xor and local function here - just

fun xor(alpha, beta) = Or(...);

will do.

like image 67
zeuxcg Avatar answered Oct 17 '22 22:10

zeuxcg