Live data from Hacker News

How Unix spell ran in 64kb RAM

blog.codingconfessions.com

21–30 of 53 posts

Re: How Unix spell ran in 64kb RAM

#21
I can't remember the name of the product but in the 80s there was a hardware spell checker for the IBM PC. It was a box that connected between your keyboard and your PC, and if you ever typed a string of letters that it did not recognize as a dictionary word, it would beep to let you know.

Re: How Unix spell ran in 64kb RAM

#22

You can write an external memory spell checker with a tiny amount of RAM: something like - sort the words in the document - eliminate unique words (they sort together) - merge the sorted words with the sorted dictionary and keep only the missing words I saw this in BASIC in Creative Computing and got it working in on my TRS-80 Color Computer which had much less than 32k of available RAM, so that was the first thing I…

I guess you really used the fact that most words are repeated to keep the byte count in check? On the old C=64 I had it was a bit of a problem not to blow out the memory with just the text of the document once you started using it for more than a 1 or 2 page paper. Keeping a second sorted copy seems almost luxurious.

I guess you could save the working copy to disk first, then do the sort, then compare, then reload the working copy. I think the C=64 developers probably avoided that strategy because the disk interface was so damn slow.

Re: How Unix spell ran in 64kb RAM

#23
post #19

One of the things that got me intrigued by Unix was an early 1980s(ish) Byte article which walked through building a (trivial example, not the "real" one) spell checker out of a split/sort/comm pipeline, something like 7 commands? 8-bit PCs didn't have anything like that, and yet it didn't look like it needed that much sophistication...

One a similar note, there is this period video where Brian Kernighan shows how to construct a spell checker using a UNIX shell one-liner:

https://youtu.be/tc4ROCJYbm0?t=4m56s

Re: How Unix spell ran in 64kb RAM

#24

You can write an external memory spell checker with a tiny amount of RAM: something like - sort the words in the document - eliminate unique words (they sort together) - merge the sorted words with the sorted dictionary and keep only the missing words I saw this in BASIC in Creative Computing and got it working in on my TRS-80 Color Computer which had much less than 32k of available RAM, so that was the first thing I…

Link seems to be broken.

works4me

Re: How Unix spell ran in 64kb RAM

#25

You can write an external memory spell checker with a tiny amount of RAM: something like - sort the words in the document - eliminate unique words (they sort together) - merge the sorted words with the sorted dictionary and keep only the missing words I saw this in BASIC in Creative Computing and got it working in on my TRS-80 Color Computer which had much less than 32k of available RAM, so that was the first thing I…

I guess you really used the fact that most words are repeated to keep the byte count in check? On the old C=64 I had it was a bit of a problem not to blow out the memory with just the text of the document once you started using it for more than a 1 or 2 page paper. Keeping a second sorted copy seems almost luxurious. I guess you could save the working copy to disk first, then do the sort, then compare, then reload th…

I may be wrong, but from "external memory" in the description I think the idea is that each of those steps can be done on disk, not RAM. An external merge sort is a pretty standard database primitive, and the other two only require purely sequential access, so are friendly to spinning disks and the like.

Re: How Unix spell ran in 64kb RAM

#26

I can't remember the name of the product but in the 80s there was a hardware spell checker for the IBM PC. It was a box that connected between your keyboard and your PC, and if you ever typed a string of letters that it did not recognize as a dictionary word, it would beep to let you know.

Xerox PC Type Right

https://vintageapple.org/pcworld/pdf/PC_World_8711_November_... page 237 has a review (big PDF warning)

Re: How Unix spell ran in 64kb RAM

#27

I can't remember the name of the product but in the 80s there was a hardware spell checker for the IBM PC. It was a box that connected between your keyboard and your PC, and if you ever typed a string of letters that it did not recognize as a dictionary word, it would beep to let you know.

Xerox PC Type Right https://vintageapple.org/pcworld/pdf/PC_World_8711_November_... page 237 has a review (big PDF warning)

>You can even set the device to recognize your password and beep if you mistype it, thereby eliminating a bevy of incorrect sign-on messages.

Wow, what a thing for a tech publication to suggest doing! Different times.

Re: How Unix spell ran in 64kb RAM

#28
> But 27-bit hash codes were too big: with 2^15 words, they needed 2^15 * 27 bits of memory, while the PDP-11 had only 2^15 * 16 bits (64kB) of RAM—compression was essential.

I'm frustrated when people put this kind of typography on the web. HTML can do superscript.

Re: How Unix spell ran in 64kb RAM

#29
post #17

For perspective, in 1983 or so, Grammatik on CP/M ran in under 64k and did "grammar checking" (spell checking, plus a bunch of expert system rules) on an 8-bit system. (It sticks in my memory because of the time spent poking at the really interesting part: that it was so compact because it was in Forth, and there was enough of an outer interpreter in the product that with a little hex editing you could just use it as…

The Wordstar editor I run on my own CP/M system, with 64k of RAM, contains the 2023-byte long "SPELL.COM" spell-checker.

I've not decompiled it to see how it works, but it's small and fast, and works well.

Post reply on HN