Thursday, March 26, 2026

Peirce's Law in Egel

 Like Scheme, Egel has a trivial inhabitant of Peirce's Law ((p->q)->p)->p too.

def peirce = [F -> try F [X -> throw X] catch [X -> X]]

The combinator peirce has Peirce's law as type and takes as an argument a function F of type (p->q)->p and we feed that function another function of type p->q that throws its argument X of type p to the outer scope.

Utter bullshit, of course. 

Friday, January 16, 2026

Matching recurring variables

The Egel interpreter is about a decade old, and I thought I kinda milked it already for all the blog posts I wanted to write about it. 

 The best overall feelings I have about the interpreter can be summed up as: A) It's a fine toy esoteric language, but please don't use it professionally. And B), I have a lot of fun coding Advent of Code solutions in it, and there's something to the language, but I cannot quite pinpoint what. 

Someone asked me where Egel would fall compared to other languages, and I am not entirely sure about that either. Q/Pure, Maude, Wolfram Language or something defined in Racket might be close. 

Refal came up during that discussion, and I looked into it. One thing that struck me is that Refal can pattern-match recurring variables. I could extend Egel with that, maybe. That would allow definitions like `def eq = \x x -> true | _ _ -> false`. It seems non-trivial, but on the other hand, all the machinery should be in place. But at the same time, it doesn't seem to useful a feature.