hnock

A Nock interpreter.
git clone git://git.jtobin.io/hnock.git
Log | Files | Refs | README | LICENSE

README.md (1202B)


      1 # hnock
      2 
      3 [![Hackage Version](https://img.shields.io/hackage/v/hnock.svg)](http://hackage.haskell.org/package/hnock)
      4 [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jtobin/hnock/blob/master/LICENSE)
      5 
      6 A [Nock][nock] interpreter.
      7 
      8 ## Install
      9 
     10 Use a simple
     11 
     12 ```
     13 stack install
     14 ```
     15 
     16 to build the `hnock` binary and get it moved somewhere on your PATH.  If you
     17 just want to build the binary, you can use `stack build`.
     18 
     19 ## Usage
     20 
     21 From bash, simply pipe Nock expressions into the `hnock` executable:
     22 
     23 ```
     24 $ echo '*[[[4 5] [6 14 15]] [0 7]]' | hnock
     25 [14 15]
     26 ```
     27 
     28 For playing around in GHCi, import the `Nock` library and use `hnock` to parse
     29 and evaluate Nock expressions:
     30 
     31 ```
     32 *Nock> hnock "*[[[4 5] [6 14 15]] [0 7]]"
     33 [14 15]
     34 ```
     35 
     36 To evaluate raw nock Nouns, i.e. to compute `nock(a)` for some noun `a`, use
     37 the `nock` function:
     38 
     39 ```
     40 *Nock> let expression = hnock "[[[4 5] [6 14 15]] [0 7]]"
     41 *Nock> expression
     42 [[[4 5] [6 [14 15]]] [0 7]]
     43 *Nock> nock expression
     44 [14 15]
     45 ```
     46 
     47 ## Testing
     48 
     49 Use a simple `stack test` to run the test suite.
     50 
     51 ## See Also
     52 
     53 * [A Nock Interpreter][anin]
     54 
     55 [nock]: https://urbit.org/docs/learn/arvo/nock/definition/
     56 [anin]: https://jtobin.io/nock
     57