procedure ximage: string image of value procedure xdump: write images of values
link ximage
May 19, 1996; Robert J. Alexander
This file is in the public domain.
ximage(x) : s Produces a string image of x. ximage() differs from image() in that it outputs all elements of structured data types. The output resembles Icon code and is thus familiar to Icon programmers. Additionally, it indents successive structural levels in such a way that it is easy to visualize the data's structure. Note that the additional arguments in the ximage procedure declaration are used for passing data among recursive levels. xdump(x1,x2,...,xn) : xn Using ximage(), successively writes the images of x1, x2, ..., xn to &errout. Some Examples: The following code: ... t := table() ; t["one"] := 1 ; t["two"] := 2 xdump("A table",t) xdump("A list",[3,1,3,[2,4,6],3,4,3,5]) Writes the following output (note that ximage() infers the predominant list element value and avoids excessive output): "A table" T18 := table(&null) T18["one"] := 1 T18["two"] := 2 "A list" L25 := list(8,3) L25[2] := 1 L25[4] := L24 := list(3) L24[1] := 2 L24[2] := 4 L24[3] := 6 L25[6] := 4 L25[8] := 5