CLN implements two symbolic (non-numeric) data types: strings and symbols.
The class
String cl_string <cl_string.h>
implements immutable strings.
Strings are constructed through the following constructors:
cl_string (const char * s)
s
.
cl_string (const char * ptr, unsigned long len)
len
characters at
ptr[0]
, ..., ptr[len-1]
. NUL characters are allowed.
The following functions are available on strings:
operator =
cl_string
and const char *
.
s.length()
strlen(s)
s
.
s[i]
i
th character of the string s
.
i
must be in the range 0 <= i < s.length()
.
bool equal (const cl_string& s1, const cl_string& s2)
const char *
.
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.
Symbols are constructed through the following constructor:
cl_symbol (const cl_string& s)
The following operations are available on symbols:
cl_string (const cl_symbol& sym)
cl_string
: Returns the string which names the symbol
sym
.
bool equal (const cl_symbol& sym1, const cl_symbol& sym2)
Go to the first, previous, next, last section, table of contents.