5 ms·
π: A Pattern Language
- felideon 17y agoOk, I found that Alt+26 on Windows gives you the single arrow (→). But how do you type the ⇒ hollow arrow? (Without charmap or copy&paste) Edit: I haven't really been able to get it to run on my Windows machine at work. I'll have to try at home later.
- spicyj 17y agoI think it's Alt+21D2.
- mbrubeck 17y agoThis reminds me a lot of http://tinlizzie.org/ometa/ http://tinlizzie.org/ometa/ (another general-purpose programming language built around pattern matching).
- deleted 17y ago[deleted]
- deleted 17y ago[deleted]
- teilo 17y agoCould someone explain this to me? If, as they say, "There is only one language construct in π: the pattern", why is there flow control, blocks, etc.? Wouldn't it be more accurate to say that a pattern is a specialized function, and the only type of function in π?
- ggchappell 17y agoI don't understand it, either, but I'll make a guess. It appears that, from a "C"-programmer point of view, π is something like a type-aware preprocessor. So, for example, the integer_potentiation snippet is using π to construct a "C" program. OTOH, I may be completely wrong. (Actually, this isn't too surprising, considering the references to "OOPSLA" and "patterns" all over the place on that page. In my experience, people who hang out at OOPSLA often come up with some interesting stuff, but don't do so well at explaining it to outsiders, this page being yet another example of this phenomenon. <grumble, grumble>.)
- andreyf 17y agopegasus_f from the "Who?" section seems even more interesting: action bring (several folders) from (an office) to (an archive) { go to (the office); enter (it), take (the folders) and leave; go to (the archive); search (the right place for (the folders)) and leave (them) (there); go back; }
- idm 17y agoAgreed. I think there are some strange syntax quirks ("go to", versus "enter" would be hard to parse into separate tokens because whitespace isn't a token delimiter). However, the syntax for "variables" is obvious, and the nesting of parenthesis is a really interesting way to create a context for specific variables. I happen to have a short temper with applescript, because there are some cases where the natural language component seems to "Get in the way." However, at least for the purpose of this example, pegasus_f strikes me as a really interesting thing to consider.
- andreyf 17y agothere are some cases where the natural language component seems to "Get in the way" I guess this is kind of like the uncanny valley [1] of language - if it's too much like natural language, but a little off, it seems much weirder than being an completely unnatural language. 1. http://en.wikipedia.org/wiki/Uncanny_valley http://en.wikipedia.org/wiki/Uncanny_valley
- raganwald 17y agoGoing deep into the shed, SNOBOL was an early homoiconic language where the primary idiom was pattern-matching over strings. A little like regular expressions with control over backtracking, side effects during pattern matching, and many other features. SNOBOL provided a very unique paradigm in its day, and I can attest that "Thinking in SNOBOL" required letting go of almost everything FORTRAN taught you about programming :-) The first implementation actually compiled SNOBOL programs into FORTRAN programs. My mind boggles at the thought. http://en.wikipedia.org/wiki/SNOBOL http://en.wikipedia.org/wiki/SNOBOL
- deleted 17y ago[deleted]
- mark_h 17y agoThis was just on LtU: http://lambda-the-ultimate.org/node/3662 http://lambda-the-ultimate.org/node/3662 Only a couple of comments right now, but it might be worth cross-referencing later.