

π: A Pattern Language - jedi_stannis
http://www.pi-programming.org/What.html

======
raganwald
Going 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>

------
andreyf
pegasus_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
Agreed. 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
_there 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>

------
teilo
Could 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
I 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>.)

------
mark_h
This was just on LtU: <http://lambda-the-ultimate.org/node/3662>

Only a couple of comments right now, but it might be worth cross-referencing
later.

------
mbrubeck
This reminds me a lot of <http://tinlizzie.org/ometa/> (another general-
purpose programming language built around pattern matching).

------
felideon
Ok, 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
I think it's Alt+21D2.

