This function is the primary function called upon by << to format expressions for printing. The default method provided by the system is to convert x to an Expression with expression and then to convert that to a net.
A new method for formatting expressions of class X may be installed by the user with code of the form net X := x -> ... . The function provided by the user should return a net or a string.
A string is formatted by wrapping it in quotation marks and converting nonprinting characters to escape sequences. A net is formatted for printing by enclosing it in a box.
i1 = "a string"
o1 = "a string"
i2 = net "a string"
o2 = "\"a string\""
i3 = ZZ[x]
o3 = ZZ[x]
o3 : PolynomialRing
i4 = x^2
2
o4 = x
o4 : ZZ[x]
i5 = net x^2
+--+
| 2|
o5 = |x |
+--+
o5 : Net
i6 = code(net,List)
-- nets.m2:23-29
net List := x -> horizontalJoin deepSplice (
"{",
unlist between(",",apply(x,i -> (
if class i === Sequence
then ("(", net i, ")")
else net i))),
"}")
See also Net, expression, Expression, and Net.
Go to main index.
Go to concepts index.