4 ms·
I tried to understand how Hoon and Nock work once and got completely lost. They happily claim that their definition of Nock is super simple and Turing Complete,
by openasocket 6y ago
I tried to understand how Hoon and Nock work once and got completely lost. They happily claim that their definition of Nock is super simple and Turing Complete, and I'm used to dealing with some really abstract things, but I simply can't deduce it. Their definition of Nock contains a couple of different combinators. They start out really simple: one to increment, one to tell if something is a list or an atom, one for equality. Then comes this one:
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
And then I'm completely lost. What on earth does this combinator do? Every time I try tracing it with an example list it quickly goes into infinite recursion.
- minitech 6y agoDid you come from the Nock 4K thing seen in https://urbit.org/docs/tutorials/nock/definition/ https://urbit.org/docs/tutorials/nock/definition/ but without the rest of the stuff on that page? It’s explained in words there: > / (slot) is a tree addressing operator. The root of the tree is 1; the left child of any node n is 2n; the right child is 2n+1. /[x y] is the subtree of y at address x. > For instance, /[1 [531 25 99]] is [531 25 99]; /[2 [531 25 99]] is 531; /[3 [531 25 99]] is [25 99]; /[6 [531 25 99]] is 25; /[12 [531 25 99]] crashes. (edit: there’s also more at https://urbit.org/docs/tutorials/nock/explanation/. https://urbit.org/docs/tutorials/nock/explanation/.)
- samatman 6y agoWell, I'm partial to my explanation of that operator. But then, I would be. https://github.com/mnemnion/ax/blob/master/comment.md#branch https://github.com/mnemnion/ax/blob/master/comment.md#branch