This is like an entirely new genre within fantasy. I don't even know what you would call it, but it is both entertaining and a beautiful showing of skill all at the same time.<p>Maybe you can't even call it fantasy since it is real code & logic with no magic involved.
> The Church. The lambda calculus. The gay agenda.<p>I just about lost it with that one. Started laughing so hard I woke up my wife...<p>> ... balancing a binary tree was an interview question which I personally bombed in 2010 ...<p>Thank you, Kyle. That first snippet gave me joy. That second snippet, though... that gave me _hope_.
I love aphyr's posts so much. Aside from just being super entertaining, they have a significant degree of pedagogical value. If one sets out to fathom these incantations, they will end up studying a large swath of under-appreciated languages and theory.
It was fun to read this because I happened to study at Indiana University where most of the work on *Kanren happened.<p>If anyone is interested in practical applications, Will Byrd (mentioned in the story) went on to work with Matt Might (HN's favorite CS-prof-turned-doctor). One of the products of that was mediKanren[0] which operates over medical research. There was some publicity around mediKanren last year.[1]<p>[0] <a href="https://github.com/webyrd/mediKanren" rel="nofollow">https://github.com/webyrd/mediKanren</a>
[1] <a href="https://www.uab.edu/news/health/item/10703-diagnosis-in-2-127-seconds-solving-a-years-long-vomiting-mystery-using-ai-research-and-brain-power" rel="nofollow">https://www.uab.edu/news/health/item/10703-diagnosis-in-2-12...</a>
I've enjoyed all the posts in this series, but this is first time it's I've "empathized" with some aspect of the problem solving.<p>I've taken a couple of stabs at writing a mini/micro-kanren in a language which _isn't_ a lisp, often following along closely with some paper from Hemann, Friedman and/or Byrd -- and if the language _doesn't_ have macros it really does get awkward. As mentioned at the PS, for a good long stretch, this post is pretty directly transcribing the 'microkanren' paper, and without macros at some point Vidrun would have had to invent some of her own idioms.<p>The other trick to having the embedded kanren really work with the host language, which is swept a bit under the rug, is that `walk*` / `walkr` in this post implicitly assumes that everything in your universe is a variable, an atomic value, or a cons. In that sense, it's a little funny that (I think) her kanren can't really solve "inside" of the structs that she asked to be provided.
I wish there was an explainAphyr site or a wiki or subreddit or something where there's a step by step explanation of both the mythology and the code involved.
" You couldn’t remember how to balance a binary tree, so you thought you’d define the transformational invariants and have Prolog solve them for you."<p>Well, yes, that's one good reason to know Prolog.
<a href="https://gist.github.com/aphyr/4d41e7655b10a68e753f729bdc1c5a6d" rel="nofollow">https://gist.github.com/aphyr/4d41e7655b10a68e753f729bdc1c5a...</a> is titled 'Minikanren in Lisp in Prolog'.<p>there's also a 'Report abuse' link nearby...