xjson
lisp-styled JSON
Last updated 7 years ago by robbrit .
Repository · Original npm · Tarball · package.json
$ cnpm install xjson 
SYNC missed versions from official npm registry.

Wat

It's an interpreter for Lisp-styled JSON.

Example:

var xjson = require("xjson").xjson;

console.log(xjson(["+", 5, 9]));  // outputs 14

// factorial
var fact =
  ["defun", "fact", ["n"],
    ["if", ["=", 0, "n"],
      1,
      ["*", "n", ["fact", ["-", "n", 1]]]]];

// tail-recursive factorial (there is no TCO at the moment though)
fact =
  ["defun", "fact", ["n"],
    ["defun", "factn", ["a", "i"],
      ["if", [">", "i", "n"],
        "a",
        ["factn", ["*", "a", "i"],
                  ["+", "i", 1],
                  "n"]]],
    ["factn", 1, 1]];

xjson(fact);
xjson(["display", ["fact", 5]]); // outputs 120

Installation

npm install xjson

Licensing

MIT License

Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2017 © taobao.org |