Code Monkey home page Code Monkey logo

nock.js's Introduction

#Nock.js

This is an implementation of Nock in JavaScript. If you don't know what Nock is, go urbit.org. Read some documentation. Then request a destroyer, run :chat, and then say hello to everyone. Your humble author might well be online (~nosryl-tarpem). Let him know if you find any bugs.

This implementation is for pedagogic purposes, i.e. to let people play around with Nock and see how it works. It's not intended to power a browser-based Arvo implementation, although if someone wants to take this and make that happen, that would be pretty awesome.

##Usage

Despite being JavaScript, this project has no web-based interface. Instead, it runs using node.js. Run repl.js like so:

node repl.js

nock.js features a parser, so enter nock pseudocode at the prompt and it will perform its reductions until it either comes up with a solution or crashes. Try entering some samples from the Urbit documentation and following along.

There's also a one-line command evaluator, called oneliner.js, which you can run like so:

node oneliner.js *[42 0 1]

This will evaluate the given command and then exit, which is useful if you want to redirect stdout. And really who doesn't?

Brian Zick has written a web-based REPL, which you can check out here.

##Strict Mode

The interpreter has two modes. Strict mode (the default) hews as closely as possible to the Nock spec. You can disable strict mode and use pre-reduced functions, which speeds things up quite a bit. Disable strict mode by entering "strict=off" at the command prompt.

Here are the pre-reduced versions of the commands, for your reference. Most of these are described in detail in Chapter 3 of the documentation:

Nock 6:
32r ::   *[a 6 b c d]               *[a *[[c d] [0 *[[2 3] [0 ++*[a b]]]]]]

Nock 7:
33r ::  *[a 7 b c]                      *[*[a b]  c]

Nock 8:
34r :: *[a 8 b c] *[[*[a b] a] c]

Nock 9:
35r :: *[a 9 b c] *[*[a c] *[*[a c] 0 b]]

Nock 10:
36r ::    *[a 10 [b c] d]   *[*[[*[a c] a] 0 3] d]
37r ::    *[a 10 b c]       *[a c]

nock.js's People

Contributors

famousj avatar

Stargazers

Victor Borja avatar Ionuț G. Stan avatar Ulric Wilfred avatar Alex Moskalyuk avatar Galen Wolfe-Pauly avatar

Watchers

James Cloos avatar  avatar

Forkers

anoxic

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.