up previous next
indent, IndentStr    --    prints in a more readable way


Syntax
indent(X: OBJECT)
indent(X: OBJECT, RecursionDepth: INT)
IndentStr(X: OBJECT): STRING
IndentStr(X: OBJECT, RecursionDepth: INT): STRING

Description
These functions produce an easy-to-read version of the argument by splitting it into several lines: a LIST or IDEAL is printed one element per line, a RECORD one field per line.

The function indent prints the result on the screen, whereas IndentStr returns it as a STRING, useful for passing it to other functions (e.g.print IndentStr(L) on file).

The second optional argument is for setting the level of recursive indentation; e.g. it can be useful when printing a list of records.

Example
/**/ use QQ[x,y];
/**/ R := record[I := ideal((x-1)^3,  (y+2)^4),  L := 5..7];
/**/ println R;
record[I := ideal(x^3 -3*x^2 +3*x -1,  y^4 +8*y^3 +24*y^2 +32*y +16), L := [5,  6,  7]]

/**/ indent(R);
record[
  I := ideal(x^3 -3*x^2 +3*x -1,  y^4 +8*y^3 +24*y^2 +32*y +16),
  L := [5,  6,  7]
]

/**/ indent(R, 2);
record[
  I := ideal(
    x^3 -3*x^2 +3*x -1,
    y^4 +8*y^3 +24*y^2 +32*y +16
  ),
  L := [
    5,
    6,
    7
  ]
]

See Also