New ask Hacker News story: Languages you must know #3 (SNOBOL)

Languages you must know #3 (SNOBOL)
4 by daly | 0 comments on Hacker News.
Remember: This is a series about languages that change the "way" and the "what" of thinking. SNOBOL is a mind-bending language the first time you use it. According to Wikipedia: "SNOBOL4 stands apart from most programming languages of its era by having patterns as a first-class data type (i.e. a data type whose values can be manipulated in all ways permitted to any other data type in the programming language) and by providing operators for pattern concatenation and alternation. SNOBOL4 patterns are a type of object and admit various manipulations, much like later object-oriented languages such as JavaScript whose patterns are known as regular expressions." (https://ift.tt/2d4XwuQ) So the idea of a "pattern as a first-class object" is vital. Indeed, the whole idea of making something "a first class object" is fundamental. This idea will show up in other "must know" languages. SNOBOL introduces dynamic statement creation and evaluation. SNOBOL introduces the idea of a pattern language. A pattern statement can succeed or fail. SNOBOL allows you to branch in either case (or not) "pattern statement" :S(win) :F(lose) One observation is that a SNOBOL program seems to be a thing of "constant length", at least in my experience. You can write patterns and use them in statements. Or you can write statements with patterns. Or you can mix-and-match. Oddly, though, every SNOBOL program I've written using any combination seems to be the same length. SNOBOL makes patterns into a language for thinking. When you write your first program you'll struggle. But learning occurs when you figure it out. Thinking in patterns shows up in compilers (BNF) and regular expressions. Non-deterministic programming shows up. So do state machines. Indeed, AI systems are pattern matching languages (although doing so in SNOBOL makes my mind hurt). SNOBOL is a "must know" language.