Topics

Typed Lisp with Pattern Matching

Yves Cloutier
 

Sorry, I know this isn't specifically about Stanza, but I know Patrick, you're a lisp hacker.

Do you know about Shen? http://shenlanguage.org/

It's pretty interesting how it's a Lisp, but also how it makes heavy use of ML-like pattern matching.  For example:

(define foldl
    F Z [] -> Z
    F Z [X | Xs] -> (foldl F (F Z X) Xs))

 

Hi Yves!

Yes! I have heard of Shen! Mark really designed quite a beautiful language. And he's also a fantastic writer. I've been meaning to work through "Logic, Proof, and Computation" when I find some spare time.

One of the most interesting things about Shen is the built-in Prolog engine that allows users to extend and define their own type system. As far as I know, this is one-of-a-kind. Beyond geeking out on type systems though, I haven't come up with a practical killer-use for this feature yet, but I'm sure someone will. When that happens, Shen will be the only language capable of supporting it.

-Patrick

Yves Cloutier
 

Yes, it is elegant. I'm going through the "Book of Shen" and waiting for "Logic, Proof and Computation to arrive.

I think it would be interesting to make a Shen interpreter using Stanza.  I think the S-Expression parser example would be a good starting point. Since Stanza has a type system it could maybe leverage that.

We'll see, I'll take a stab at it over the weekend to see how far I get.