symbol Specification Sheet
Computer Algebra Kit (c) 1993,00 by Comp.Alg.Objects. All Rights Reserved.
SymbolInherits from: CAObject
Class DescriptionMaturity Index : Relatively Mature
For symbols created with the factory method str:, the first character of the str of the symbol object must be a letter. Subsequent characters can be letters or digits. Whitespace or control characters are not allowed.
Using the factory method chars:count:, it's possible to use arbitrary C strings as the value of the symbol; in this case Symbol just acts like a regular Objective C String class. If you intend to use the object as a mathematical symbol, it's not advised to do this as you might incorrectly interpret spaces etc. as mathematical operators.
+str:(STR)aStringCreates a new symbol, and sets its value to a copy of aString. Returns nil if aString is not suited as value for a symbol (when the first letter is not a letter, for instance).
+chars:(STR)aBuffercount:(int)numCharsCreates a new symbol, and sets its value to a copy of the first numChars characters of aBuffer. For this method, there are no restrictions on the C string being used.
-copyReturns a new symbol object. Copies the string.
-deepCopyEquivalent to copy.
-releaseFrees the memory for the string value.
- (STR)strReturns the string value of the symbol. The first character is a letter, subsequent characters can be alphanumeric.
-str:(STR)aStringCreates a new symbol, and sets its value to a copy of aString. Returns nil if aString is not suited as value for a symbol.
- (unsigned)hashReturns a hash value based upon the string.
- (BOOL)isEqual:bReturns YES if the str's of both objects are equal.
- (int)compare:bCompares the str's of both objects.
- (BOOL)isLetterWhether the symbol consists of just one character (and hence, is a letter, not a digit).
-printOn:(IOD)aFilePrints the symbol to aFile.