Neil Bawd 2004-02-09
Selections and collections from Wil Baden and Neil Bawd
Alphabetic list is a set of sublists where each sublist is a linked list of nodes with alphanumeric identification and in alphabetic order. A hash function assigns the alphanumeric identifications to the appropriate sublist.
In 1987 Ron Rivest developed the RC4 cipher-system. It used a well-guarded proprietary trade secret. The system was popular and is used in several hundred commercial cryptography products.
Seven years later, source code alleged to be equivalent to RC4 was published anonymously. Users with legal copies of RC4 confirmed compatibility.
The code is extremely simple and can be written by most programmers from the description.
Display short phrase in BIG letters.
Uses Uses
Base64 Content-Transfer-Encoding
Gregorian, Julian, ISO, Islamic, and Hebrew Calendars.
Case-insensitive Comparison using Latin-1
Case insensitive comparison using Latin-1 character set. Also character test and conversion functions.
Case-insensitive Comparison for Macintosh
Case insensitive comparison using Macintosh or Latin-1 character set. Also character test and conversion functions.
Small definitions to be made in source files that need them.
CRC-32 International Standard 32-Bit CRC
Calculation of the International Standard 32-bit CRC, cyclical redundancy check. It uses nonce-words as throw-away definitions to build a table to speed it up.
Data Encryption Standard
DFC Differential File Comparison 2002
Make a line by line comparison of two text files, showing where and how they are different. Can also collate two text files.
Vocabulary for Dataspace Output
[READY] ... [SET] ... [GO]>
EASTER According to Knuth 2002-03-31
The following algorithm, due to the Neapolitan astronomer Aloysius Lilius and the German Jesuit mathematician Christopher Clavius in the late 16th century, is used by most Western churches to determine the date of Easter Sunday for any year after 1582.
With Forth Programmer’s Handbook as an authoritative work about contemporary Forth, for portability today’s Forth implementations and tutorials should agree with it when possible.
GIMP New Mersenne Prime, 2001-12-05
Announcement. Also see Mersenne Twister.
Forth control flow is complete. Everything that GOTO and LABEL can do, Forth can replicate. Using CS-ROLL, Forth can implement gotos and labels.
Knuth’s Subtractive RNG from The Stanford GraphBase.
See ran_array
A Graycode is a representation of numbers such that the codes for a number and its successor differ by one bit.
HEAPSORT can be converted directly to Standard Forth from Knuth’s description in TAOCP with no other definition but PRECEDES (and NOT).
Tools to read a file. Tutorial as documentation.
Beginning with weights in ascending order, construct an extended binary tree having minimum weighted path lengths.
Various simple pseudorandom number generators.
Test for little endian arithmetic.
All words in Longman dictionaries are defined with these ~2000 words.
J. Ziv & A. Lempel 1977 Data Compression. See also Programmers are lousy lovers.
Billions and Billions of Random Numbers.
Also see GIMP.
A New Kind of Science — MacForth
“This long-awaited work from one of the world’s most respected scientists presents a series of dramatic discoveries never before made public. Starting from a collection of simple computer experiments - illustrated in the book by striking computer graphics - Stephen Wolfram shows how their unexpected results force a whole new way of looking at the operation of our universe.”
SwiftForth uses { for comments. MPE uses { for locals.
So divide and concur.
DPL — NH — NUMBER — NUMBER?
OPG Operator Precedence Grammar
Translate Floating Point Formulas by Operator Precedence Grammar.
Permutation by adjacent exchange.
Porter’s algorithm to remove suffixes from a word.
Notes on data compression, especially LZ77
Ancient (1983) code for recursive Quicksort without median of three or insertion-sort.
This is the sort used in most Forth benchmarks. It has an environmental dependency that 1 CELLS is a power of 2.
It was originally written for figForth and Forth-83, before Standard Forth.
Quote in string literals. String literals end with a single double-quote. Double double-quote used for a quote in a string.
ran_array: Knuth’s RNG from TAOCP, updated 2002
Knuth’s recommended random number generator from The Art of Computer Programming ninth printing of the third edition.
This generator is good for a large billion streams of billions of numbers, unlike a linear congruential sequence in 32-bIt arithmetic (good for one stream of a few million numbers), or a linear congruential sequence in 16-bit arithmetic, such as from Starting Forth (good for one stream of about five dozen numbers).
The same numbers are generated in Forth, C, and Fortran.
A one-way cryptographic function which takes a message of less than 18 quintillion (18,446,744,073,709,551,616) bits in length and produces a 160-bit message digest.
Display clipboard n up. UP UPN UPV UPW
SOLITAIRE is a Forth implementation of the Solitaire cryptosystem, as designed by Bruce Schneier and used in Neil Stephenson’s novel Cryptonomicon, ISBN 0-380-97346-4.
Convert name to Soundex code.
Voice of America “Special English” word list.
Kernighan and Pike, The Unix Programming Environment, (1984) give a name-correcting file lookup. The K&P definition uses C-style strings, so SPELL-DISTANCE had to be written from scratch.
This is helpful with “word unknown” error. It catches the most common typing goofs.
ONLY STANDARD DEFINITIONS
String Parsing with Generalization of SKIP and SCAN
Toolbelt functions for handling strings. Equivalent to grep.
Structured Programming with GOTOs in Forth
Donald E. Knuth, “Structured Programming with goto Statements” (1974), reprinted in Literate Programming (1992), discusses situations where gotos are appropriate. In this page his examples have been transcribed from pseudo Algol to ortho Forth.
General tools for Personal and Sharable code.
Glossary of Toolbelt words, and where to find them.
A classification of programming anomalies.
Iterated interpretation with single words.
WORDS — MINE — ADDS — DEFS
Thanks to: Ken Clark, Michael Gassanenko, Peter Lawrence, Derek Peschel, Ed S, Jeff Sickel, Lars Van Jeurissen, David Williams, Leo Wong, for advice and support.
Comments, criticism, and correction to
Neil Bawd, Goat Hill, Caliphornia