Re: Peculiar number formatting?

"Christopher Stacy (as cstacy at dtpq dot com)" <[email protected]> Tue, 19 May 2026 15:47:27 -0400
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
On 5/19/26 10:19 AM, Tim Bradshaw wrote:
> On 19 May 2026, at 13:33, Christopher Stacy <[email protected]> wrote:
>>
>> MACLISP never did have strings nor formatted output.
>
> I don't have personal knowledge, but it looks like some late versions 
> did have format: see https://www.maclisp.info/pitmanual/io.html#16.12.1.
>
> My guess is that this must have been retrofitted from ?Lisp Machine 
> Lisp? It's clearly associated with 'New I/O' which presumably means it 
> was a recent addition.  I suppose it all worked on the fake strings 
> which the manual describes.

In 1982 Kent Pitman wrote a Lisp Machine compatibility library that 
provided DEFSUBST (inline DEFUN), ONCE-ONLY macro hygene), DOLIST, 
DOTIMES,  DO*, and  and WITH-OPEN-FILE and WITH-OPEN-STREAM.
He had also written the "Fake Strings" library around that time, so that 
people could have things like STRING-APPEND and not have to re-invent 
the wheels in every program. Perhaps this came a bit late in the big 
picture for MACLISP.

FORMAT was implemented to be similar to what the Lisp Machine had. I 
think it was also around 1980. Its only involvement with strings was to 
take the control string, which was a symbol like '|~%Hello ~A|, and 
"explode" it into a list of symbols representing the ersatz substrings 
(symbols such as '|~|), and process a list of those. That's the MACLISP 
way of doing "strings". It did not use Kent's fake string library, which 
had not been written yet. It defined its own subroutines such as:

(DEFUN FORMAT/:NSUBSTRING (STR FROM TO)
        (DECLARE (FIXNUM I FROM TO))
        (DO ((NEW-STR () (PUSH (GETCHARN STR (1+ I)) NEW-STR))
         (I FROM (1+ I)))
        ((>= I TO) (MAKNAM (NREVERSE NEW-STR)))))

GETCHARN returns the nth character of a symbol's name; MAKNAM takes a 
list of such and creates a new symbol. It is mentioned in the audio play 
"I Think We're All Bozos On This Bus" by Firesign Theatre. The line is 
"READ: UNHAPPY MAKNAM". The way I heard it, the error message is not 
acrually in MACLISP, but in some Stanford dialect. And it happened in 
ELIZA. It was of course some bug where it called MAKNAM on invalid 
input: a leading or trailing "^M" that didn't get stripped off some 
input and was not allowed in symbol names.

When I used all three of those things (fake-strings, format, and the 
LISPM compatibility library) in a program in November 1983, they were 
all fairly new things.  Kent was my office-mate and showed me his 
libraries. This was the end of the era of MACLISP.

"New IO" was not quite that new, but which was an internal 
re-implementation of some lower-level code that allowed a new type of 
object to be passed around, supporting the notion of an IO stream. (As 
opposed to a number indicating an operating system IO channel.) The most 
interesting thing here was the invention of the "software file array", 
one of those new stream designator objects. An SFA could be programmed 
to come in different flavors with different behaviors -- an 
object-oriented approach. (I don't know that any users actually ever 
wrote any such methods.) Lisp did not have any OOP at that time, but the 
inventor of SFAs, Howard Canon, would soon remedy that situation by 
inventing Flavors (for the Lisp Machine, of course).

Read me, Doctor Memory?