File: cln_8.html

package info (click to toggle)
cln 1.1.13-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 13,040 kB
  • ctags: 17,214
  • sloc: cpp: 79,175; sh: 7,794; ansic: 4,194; makefile: 631; lisp: 115
file content (208 lines) | stat: -rw-r--r-- 8,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html40/loose.dtd">
<HTML>
<!-- Created on May, 7 2006 by texi2html 1.66 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people <dev@texi2html.cvshome.org>
Send bugs and suggestions to <users@texi2html.cvshome.org>

-->
<HEAD>
<TITLE>CLN, a Class Library for Numbers: Symbolic data types</TITLE>

<META NAME="description" CONTENT="CLN, a Class Library for Numbers: Symbolic data types">
<META NAME="keywords" CONTENT="CLN, a Class Library for Numbers: Symbolic data types">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.66">

</HEAD>

<BODY LANG="en" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">

<A NAME="SEC52"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_7.html#SEC51"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC53"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_7.html#SEC49"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln.html#SEC_Top"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_9.html#SEC55"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_13.html#SEC75">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H1> 8. Symbolic data types </H1>
<!--docid::SEC52::-->
<P>

CLN implements two symbolic (non-numeric) data types: strings and symbols.
</P>
<P>

<TABLE BORDER="0" CELLSPACING="0">
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="cln_8.html#SEC53">8.1 Strings</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
<TR><TD ALIGN="left" VALIGN="TOP"><A HREF="cln_8.html#SEC54">8.2 Symbols</A></TD><TD>&nbsp;&nbsp;</TD><TD ALIGN="left" VALIGN="TOP"></TD></TR>
</TABLE>
<P>

<A NAME="Strings"></A>
<HR SIZE="6">
<A NAME="SEC53"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC54"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_9.html#SEC55"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_13.html#SEC75">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 8.1 Strings </H2>
<!--docid::SEC53::-->
<P>

The class
</P>
<P>

<TABLE><tr><td>&nbsp;</td><td class=example><pre>                      String
                     cl_string
                   &lt;cln/string.h&gt;
</pre></td></tr></table><P>

implements immutable strings.
</P>
<P>

Strings are constructed through the following constructors:
</P>
<P>

</P>
<DL COMPACT>
<DT><CODE>cl_string (const char * s)</CODE>
<DD>Returns an immutable copy of the (zero-terminated) C string <CODE>s</CODE>.
<P>

</P>
<DT><CODE>cl_string (const char * ptr, unsigned long len)</CODE>
<DD>Returns an immutable copy of the <CODE>len</CODE> characters at
<CODE>ptr[0]</CODE>, <small>...</small>, <CODE>ptr[len-1]</CODE>. NUL characters are allowed.
</DL>
<P>

The following functions are available on strings:
</P>
<P>

</P>
<DL COMPACT>
<DT><CODE>operator =</CODE>
<DD>Assignment from <CODE>cl_string</CODE> and <CODE>const char *</CODE>.
<P>

</P>
<DT><CODE>s.length()</CODE>
<DD><A NAME="IDX270"></A>
<DT><CODE>strlen(s)</CODE>
<DD><A NAME="IDX271"></A>
Returns the length of the string <CODE>s</CODE>.
<P>

</P>
<DT><CODE>s[i]</CODE>
<DD><A NAME="IDX272"></A>
Returns the <CODE>i</CODE>th character of the string <CODE>s</CODE>.
<CODE>i</CODE> must be in the range <CODE>0 &lt;= i &lt; s.length()</CODE>.
<P>

</P>
<DT><CODE>bool equal (const cl_string&amp; s1, const cl_string&amp; s2)</CODE>
<DD><A NAME="IDX273"></A>
Compares two strings for equality. One of the arguments may also be a
plain <CODE>const char *</CODE>.
</DL>
<P>

<A NAME="Symbols"></A>
<HR SIZE="6">
<A NAME="SEC54"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC53"> &lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_9.html#SEC55"> &gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_9.html#SEC55"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_13.html#SEC75">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<H2> 8.2 Symbols </H2>
<!--docid::SEC54::-->
<P>

Symbols are uniquified strings: all symbols with the same name are shared.
This means that comparison of two symbols is fast (effectively just a pointer
comparison), whereas comparison of two strings must in the worst case walk
both strings until their end.
Symbols are used, for example, as tags for properties, as names of variables
in polynomial rings, etc.
</P>
<P>

Symbols are constructed through the following constructor:
</P>
<P>

</P>
<DL COMPACT>
<DT><CODE>cl_symbol (const cl_string&amp; s)</CODE>
<DD>Looks up or creates a new symbol with a given name.
</DL>
<P>

The following operations are available on symbols:
</P>
<P>

</P>
<DL COMPACT>
<DT><CODE>cl_string (const cl_symbol&amp; sym)</CODE>
<DD>Conversion to <CODE>cl_string</CODE>: Returns the string which names the symbol
<CODE>sym</CODE>.
<P>

</P>
<DT><CODE>bool equal (const cl_symbol&amp; sym1, const cl_symbol&amp; sym2)</CODE>
<DD><A NAME="IDX274"></A>
Compares two symbols for equality. This is very fast.
</DL>
<P>

<A NAME="Univariate polynomials"></A>
<HR SIZE="6">
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_8.html#SEC52"> &lt;&lt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_9.html#SEC55"> &gt;&gt; </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT"> &nbsp; <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_13.html#SEC75">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cln_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
by <I>Richard B. Kreckel</I> on <I>May, 7 2006</I>
using <A HREF="http://texi2html.cvshome.org"><I>texi2html</I></A>
</FONT>

</BODY>
</HTML>