The Revised Maclisp Manual | Page A-14 | ||||||
|
|
Strings | Concept | Text Strings |
Except on Multics, Maclisp does not have strings.
There are two substitute facilities for strings in Maclisp, referred to as “real” strings and “fake” strings.
The “fake” string package is the simplest. Symbols which have +INTERNAL-STRING-MARKER property (other than NIL) are always printed with string quotes around them and are never interned by INTERN. This supports the visual illusion that they are strings. The predicate SYMBOLP still returns T for fake strings although a function such as:
(DEFUN STRINGP (X) (AND (SYMBOLP X) (GET X '+INTERNAL-STRING-MARKER)))
may suffice for many applications to tell symbols from strings.
The syntax "..." will create an uninterned symbol with a +INTERNAL-STRING-MARKER property of T and will assign that symbol to itself. Hence, single-quote is not needed to quote fake strings. For example, where in early Maclisp one wrote expressions such as:
(error '|Bad argument to FOO| x)
(princ '|This is a message.|)
one can now write:
(error "Bad argument to FOO" x)
(princ "This is a message.")
and have code which is syntactically compatible with code for languages which have strings.
No special functions are provided for manipulating fake strings. GETCHARN and FLATC may serve for simple character indexing. And, of course, there are always SYMBOLCONC, PNGET, EXPLODEC, IMPLODE, etc.
The “real” string package involves a lot of runtime overhead in terms of space and has not become widely accepted as a reliable string implementation. It works via the ill-documented Maclisp extended datatype facility and redefines the syntax "..." to produce real strings instead of fake ones. The functions it provides are largely similar to those that had been intended to go into NIL. Also, because real strings are implemented as hunks, they are not atoms.
Unless otherwise specified, all documentation in this manual that speaks of strings refers to fake strings.
+INTERNAL-STRING-MARKER | ||
[PDP-10 Only] Used to mark the property lists of symbols masquerading as strings in the Maclisp “fake string” facility.
STRINGP | Function | (STRINGP q) |
|
The Revised Maclisp Manual (Sunday Morning Edition) Published Sunday, December 16, 2007 06:17am EST, and updated Sunday, July 6, 2008. |
|