seshat
seshat copied to clipboard
Code like an Egyptian
Seshat is a programming language in Egyptian hieroglyphs. Its goal is to make programming easy for anyone who can read and write Egyptian hieroglyphs.
"Seshat" (๐ Zแบ๊ฃ.t) is the name of an Egyptian goddess. The goddess of writing, architecture, and mathematics, she would definitely be the goddess of programming.
# hello.seshat
๐น๐ก ๐๐๐ก ๐
๐๐๐๐ฉ๐๐
จ๐๐๐๐๐๐ช๐ง๐ข
# ir=k zแบ๊ฃ=k แธd-mdw j.nแธ Zแบ๊ฃ.t Nb.t Wr.t Zแบ๊ฃ Nb.t Jqd.w grแธฅ
# "Do write: "Hail Seshat, the Great, Mistress of the Script, Mistress of the Builders."
$ node build/lib/seshat.js hello.seshat
๐๐ฉ๐๐
จ๐๐๐๐๐๐ช๐ง
But seriously, there are upsides about ancient Egyptian programming
Algorithms before antiquity
Among the oldest mathematical texts in human history are Rhind Mathematical Papyrus and Moscow Mathematical Papyrus. They mostly consist of problems and their solutions, and the solutions are written as line-by-line instructions. Like a description of an algorithm, they're very programmatic:
Make 10 heqats of the fat into ro; it shall become 3200.
Make a year into days; it shall become 365.
Divide 3200 by 365; it shall become 8 + 2/3 + 1/10 + 1/2190.
Make this in [haqet and ro notation]; 1/64 [haqet and] 1/3 + 1/10 + 1/2190 ro.-- from Rhind Mathematical Papyrus Problem 66
x = heqat_to_ro(10)
assert x == 3200
assert days_in_a_year == 365
x = x / days_in_a_year
assert x == 8 + 2/3 + 1/10 + 1/2190
result = ro_to_haqet_and_ro(x)
assert result.haqet == 1/64
assert result.ro == 1/13 + 1/10 + 1/2190
Binary calculations
For multiplications and divisions, Egyptians used a method called "doubling." For example, to calculate 2000 * 5, they simply doubled 2000 until the multiplier reachs high enough for 5, and added things up:
\ 1 2000
2 4000
\ 4 8000
Total 10000
-- from Rhind Mathematical Papyrus Problem 52
Over 3000 years later, it is similar to how computers multiply numbers every day.
Type systems everywhere
Egyptians used what we call "determinatives" at the ends of words to specify the categories of the meanings of the words. For example, the words ๐ข๐๐ป ๊ฅแธฅ๊ฅ "to stand" and ๐ข๐๐ค ๊ฅแธฅ๊ฅ "heap, quantity (in mathematics)" share the same spelling ๐ข๐ ๊ฅแธฅ๊ฅ, but the determinatives ๐ป and ๐ค tell the meaning and make the words different. Like when we declare variables in typed programming languages.
In Seshat, you might use ๐ค at the end of a variable to indicate it's about the quantity, namely a number variable. Or a papyrus scroll ๐ for the string variables.
Documentation
TODO
References & Further Readings
The first books
Reimer (2014) is a good introductory book about ancient Egyptian mathematics.
If you are interested in Egyptian hieroglyphs for the first time, McDermott (2001) would be a good starter. Collier & Manley (1998) gives more about grammar and vocabulary.
- Collier, M. & Manley, B. (1998). How to read Egyptian hieroglyphs: a step-by-step guide to teach yourself. Univ of California Press.
- at archive.org
- ใ(๋์๋ฐ๋ฌผ๊ด์ด ๋ง๋ ) ์ด์งํธ ์ํ๋ฌธ์ ์ฝ๋ ๋ฒใ. ํ์ฐํฌ ์ฎ๊น. ๋ฃจ๋น๋ฐ์ค, 2005.
- McDermott, B. (2001). Decoding Egyptian hieroglyphs: How to read the secret language of the pharaohs. Chronicle Books.
- at archive.org
- ใํ๋ผ์ค์ ๋น๋ฐ๋ฌธ์: ์ด์งํธ ์ํ๋ฌธ์ ์ฝ๋ ๋ฒใ. ๊ถ์์ง ์ฎ๊น. ์๊ฒฝ, 2005.
- Reimer, D. (2014). Count like an Egyptian: a hands-on introduction to ancient mathematics. Princeton University Press.
Language & dictionaries
- Allen, J. P. (2000). Middle Egyptian: An introduction to the language and culture of hieroglyphs. Cambridge University Press.
- Budge, E. A. W. (1911). A Hieroglyphic Vocabulary to the Theban Recension of the Book of the Dead: with an index to all the English equivalents of the Egyptian words (Vol. 31). Kegan Paul, Trench, Trรผbner & Co. Ltd.
- Budge, E. A. W. (1920). An Egyptian Hieroglyphic Dictionary: with an index of english words, king list, and geographical list with indexes, list of hieroglyphic characters, coptic and semitic alphabets (Vols. 1-2). John Murray.
- Dickson, P. (2006). Dictionary of middle Egyptian in Gardiner classification order.
- Faulkner, R. O. (1964). A concise dictionary of Middle Egyptian.
- Gardiner, A. H. (1927). Egyptian grammar: being an introduction to the study of hieroglyphs. 3rd ed. Oxford University Press.
- Loprieno, A. (1995). Ancient Egyptian: a linguistic introduction. Cambridge University Press.
Online dictionaries
- Kilani, Marwan. (2000). Madรนwwe Project - ThotBank dataset.
- Ancient Egyptian Dictionary.
- Thesaurus Linguae Aegyptiae.
The texts & researches
- Chace, A. B., Archibald, R. C., Bull, L., Glanville, S. R. K., & Manning, H. P. (1929). The Rhind Mathematical Papyrus. Volume II: Photographs, Transcription Transliteration, Literal Translation. Mathematical Association of America.
- Clagett, M. (1999). Ancient Egyptian Science: A Source Book (vol. 3). American Philosophical Society.
- Imhausen, A. (2002). รgyptische Algorithmen: eine Untersuchung zu den mittelรคgyptischen mathematischen Aufgabentexten (Vol. 65). Harrassowitz Verlag.
- Ritter, J. (2002). Closing the Eye of Horus: The Rise and Fall of 'Horus-eye Fractions'. In J. M. Steele & A. Imhausen (Eds.), Under One Sky: Astronomy and Mathematics in the Ancient Near East (pp. 297-323). Ugarit-Verlag.
- Sethe, K. (1908). Die altรคgyptischen Pyramidentexte nach den Papierabdrucken und Photographien des Berliner Museums, (Vols. 1-2). J. C. Hinrichs'sche Buchhandlung.
- Struve, W. W. (1930). Mathematischer Papyrus des staatlichen Museums der schรถnen Kรผnste in Moskau: herausgegeben und kommentiert von WW Struve, unter Benutzung einer hieroglyphischen Transkription von BA Turajeff (Quellen und Studien zur Geschichte der Mathematik, Abt. A, Quellen, Band 1). Verlag von Julius Springer.