View( obj1, obj2... ) F
View shows the objects obj1, obj2... etc. in a short form
on the standard output.
View is called in the read--eval--print loop,
thus the output looks exactly like the representation of the
objects shown by the main loop.
Note that no space or newline is printed between the objects.
Print( obj1, obj2... ) F
Also Print shows the objects obj1, obj2... etc.
on the standard output.
The difference compared to View is in general that the shown form
is not required to be short,
and that in many cases the form shown by Print is GAP readable.
gap> z:= Z(2); Z(2)^0 gap> v:= [ z, z, z, z, z, z, z ]; <a GF2 vector of length 7> gap> Print( v ); [ Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0 ]gap>
Another difference is that Print shows strings without the enclosing
quotes, so Print can be used to produce formatted text on the
standard output (see also chapter Strings and Characters).
Some characters preceded by a backslash, such as \n, are processed
specially (see chapter Special Characters).
PrintTo can be used to print to a file (see PrintTo).
gap> for i in [1..5] do > Print( i, " ", i^2, " ", i^3, "\n" ); > od; 1 1 1 2 4 8 3 9 27 4 16 64 5 25 125
gap> g:= SmallGroup(12,5); <pc group with 3 generators> gap> Print(g); Group( [ f1, f2, f3 ] )gap> gap> View(g); <pc group with 3 generators>gap>
ViewObj( obj ) O
PrintObj( obj ) O
The functions View and Print actually call the operations
ViewObj and PrintObj, respectively, for each argument.
By installing special methods for these operations,
it is possible to achieve special printing behavior for certain objects
(see chapter Method Selection in the programmer's manual).
The only exceptions are strings (see Chapter Strings and Characters),
for which the default PrintObj and ViewObj methods as well as the
function View print also the enclosing doublequotes, whereas Print
strips the doublequotes.
The default method for ViewObj is to call PrintObj.
So it is sufficient to have a PrintObj method for an object in order
to View it.
If one wants to supply a ``short form'' for View,
one can install additionally a method for ViewObj.
Display( obj ) O
Displays the object obj in a nice, formatted way which is easy to read (but might be difficult for machines to understand). The actual format used for this depends on the type of obj.
gap> c:= CharacterTable( "A5" );
CharacterTable( "A5" )
gap> Display(c);
2 2 2 . . .
3 1 . 1 . .
5 1 . . 1 1
1a 2a 3a 5a 5b
2P 1a 1a 3a 5b 5a
3P 1a 2a 1a 5b 5a
5P 1a 2a 3a 1a 1a
X.1 1 1 1 1 1
X.2 3 -1 . A *A
X.3 3 -1 . *A A
X.4 4 . 1 -1 -1
X.5 5 1 -1 . .
A = -E(5)-E(5)^4 = (1-ER(5))/2 = -b5
Name( obj ) A
The name of an object is used only for viewing the object via this name.
There are no methods installed for computing names of objects,
but the name may be set for suitable objects, using SetName.
gap> c:= CharacterTable( "A5" ); CharacterTable( "A5" ) gap> SetName( c, "tblA5" ); c; tblA5
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual