urbit/pub/doc/nock.md
2015-06-19 17:16:48 -04:00

1.3 KiB

nock

nock is our machine code.

nock is a homoiconic combinator algebra, not much fancier than SKI combinators. The spec fits on a T-shirt and gzips to 340 bytes.

Think of nock as a kind of functional assembly language. It's not like assembly language in that it's directly executed by the hardware. It is like assembly language in that:

  • Everything in Urbit executes as nock.
  • You wouldn't want to program directly in nock.
  • Learning to program directly in nock is a great way to start understanding urbit from the ground up.

Just as Unix runs C programs by compiling them to assembler, Urbit runs Hoon programs by compiling them to nock. You could try to learn Hoon without learning nock. But just as C is a thin wrapper over the physical CPU, Hoon is a thin wrapper over the nock virtual machine. It's a tall stack made of thin layers, which is much easier to learn a layer at a time.

And unlike most fundamental theories of computing, there's really nothing smart or interesting about nock. Of course, in a strictly formal sense, all of computing is math. But that doesn't mean it needs to feel like math. nock is a simple mechanical device and it's meant to feel that way.