Neil Bawd’s Ugly Home Page 2002

Neil Bawd’s Ugly Home Page

Neil Bawd 2004-02-09

Selections and collections from Wil Baden and Neil Bawd

  1. Alphabetic List

    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.

  2. ARCFOUR Alleged RC4

    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.

  3. BANNER 1960-07-04

    Display short phrase in BIG letters.
    Uses Uses

  4. BASE64

    Base64 Content-Transfer-Encoding

  5. Calendrical Calculations

    Gregorian, Julian, ISO, Islamic, and Hebrew Calendars.

  6. Case-insensitive Comparison using Latin-1

    Case insensitive comparison using Latin-1 character set. Also character test and conversion functions.

  7. Case-insensitive Comparison for Macintosh

    Case insensitive comparison using Macintosh or Latin-1 character set. Also character test and conversion functions.

  8. Common Values and Operations

    Small definitions to be made in source files that need them.

  9. 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.

  10. DES

    Data Encryption Standard

  11. 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.

  12. Vocabulary for Dataspace Output

    [READY] ... [SET] ... [GO]>

  13. 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.

  14. FPH Popular Extensions

    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.

  15. GIMP New Mersenne Prime, 2001-12-05

    Announcement. Also see Mersenne Twister.

  16. GOTO in Forth 2000-06-10

    Forth control flow is complete. Everything that GOTO and LABEL can do, Forth can replicate. Using CS-ROLL, Forth can implement gotos and labels.

  17. GraphBase Flip 1993-09-11

    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).

  20. How to Read a File

    Tools to read a file. Tutorial as documentation.


    Beginning with weights in ascending order, construct an extended binary tree having minimum weighted path lengths.

  22. Linear Congruential Sequences

    Various simple pseudorandom number generators.

  23. Little Endian

    Test for little endian arithmetic.

  24. Longman Defining Vocabulary

    All words in Longman dictionaries are defined with these ~2000 words.

  25. LZ77 Data Compression

    J. Ziv & A. Lempel 1977 Data Compression. See also Programmers are lousy lovers.

  26. Mersenne Twister 2002 Update

    Billions and Billions of Random Numbers.
    Also see GIMP.

  27. 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.”

  28. Nice Locals

    SwiftForth uses { for comments. MPE uses { for locals.
    So divide and concur.

  29. Number Conversion for Input


  30. OPG Operator Precedence Grammar

    Translate Floating Point Formulas by Operator Precedence Grammar.

  31. PERM

    Permutation by adjacent exchange.

  32. Porter Stemming Algorithm

    Porter’s algorithm to remove suffixes from a word.

  33. Programmers are lousy lovers.

    Notes on data compression, especially LZ77

  34. QSORT

    Ancient (1983) code for recursive Quicksort without median of three or insertion-sort.

  35. QUICKSORT - Non-Recursive

    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.

  36. Quote in String

    Quote in string literals. String literals end with a single double-quote. Double double-quote used for a quote in a string.

  37. 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.

  38. Rounded Division

  39. SHA-1 Secure Hash Algorithm

    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.

  40. Show Up<

    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.

  43. Special English

    Voice of America “Special English” word list.

  44. Spell Distance

    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.



  46. String Parsing with Generalization of SKIP and SCAN

    Toolbelt functions for handling strings. Equivalent to grep.

  47. 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.

  48. SwiftForth Glossary as .html

  49. SwiftForth Glossary as .txt

  50. TOOLBELT 2002

    General tools for Personal and Sharable code.

  51. Toolbelt Glossary

    Glossary of Toolbelt words, and where to find them.

  52. Types of Error

    A classification of programming anomalies.

  53. The Ultimate Question ??

  54. USES:

    Iterated interpretation with single words.

  55. When you’ve seen one Forth…

  56. Where is Wil Baden?

  57. WORDS Reworked for PMF


  58. Wups 2003-03-09

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