Top
Back: 5.1.104 random
Forward: 5.1.106 reduce
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.1 Functions
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.1.105 read

Syntax:

read ( link_expression )
for DBM links:
read ( link_expression )
read ( link_expression, string_expression )

Type:

any

Purpose:

reads data from a link.
For ASCII links, the content of the entire file is returned as one string. If the ASCII link is the empty string, read reads from standard input.
For MP links, one expression is read from the link and returned after evaluation.
For MPtcp links the read command blocks as long as there is no data to be read from the link. The status command can be used to check whether or not there is data to be read.
For DBM links, a read with one argument returns the value of the next entry in the data base, and a read with two arguments returns the value to the key given as the second argument from the data base.

Example:
 
  ring r=32003,(x,y,z),dp;
  ideal i=x+y,z3+22y;
  // write the ideal i to the file save_i
  write(":w save_i",i);
  ring r0=0,(x,y,z),Dp;
  // create an ideal k equal to the content
  // of the file save_i
  string s="ideal k="+read("save_i")+";";
  execute(s);
  k;
→ k[1]=x+y
→ k[2]=z3+22y

See execute; getdump; link; status; write.


Top Back: 5.1.104 random Forward: 5.1.106 reduce FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.1 Functions Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.