CoCoA:Sprint

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sprint

convert to a string

Description

This function takes any CoCoA expression and converts its value to a

string. One use is to check for extremely long output before printing

in a CoCoA window.

Example

  Use R ::= Q[x,y];
  I := Ideal(x,y);
  J := Sprint(I);
  I;
Ideal(x, y)
-------------------------------
  J;          -- The output for I and J looks the same, but ...
Ideal(x, y)
-------------------------------
  Type(I);   -- I is an ideal, and
IDEAL
-------------------------------
  Type(J);  -- J is just the string <quotes>Ideal(x, y)</quotes>.
STRING
-------------------------------
  J[1];  -- the 1st character of J
I
-------------------------------
  J[2];  -- the 2nd character of J
d
-------------------------------
  Len(J);  -- J has 11 characters
11
-------------------------------

Syntax

Sprint(E:OBJECT):STRING

Introduction to IO

IO.SprintTrunc

Print

PrintLn

   <type>io</type>
   <type>printing</type>
   <type>string</type>