Skip to content

rpalo/JSlN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSlN

JavaScript list Notation (the "l" is lowercase because it's much funnier that way).

Do you have friends trying to sneak JSON-as-code solutions into your architecture? Call them a coward and send them JSlN. In JSlN, we have a fully (I mean kind of) functional LISP dialect with not an object in sight. Now you can have a fully executable language, and, because it's JSON, you don't have to check it into source-control, you can store it wherever you're storing your JSON "configs."

(This is all very tongue-in-cheek. Don't use this.)

Example

[
  [
    "fun",
    ["'", "fizzbuzz_one", "i"],
    [
      "'",
      "select",
      ["'", ["==", ["%", "i", 15], 0], ["print", "fizzbuzz"]],
      ["'", ["==", ["%", "i", 5], 0], ["print", "buzz"]],
      ["'", ["==", ["%", "i", 3], 0], ["print", "fizz"]],
      ["'", ["print", "i"]]
    ]
  ],
  [
    "fun",
    ["'", "run_fizzbuzz", "n"],
    [
      "'",
      "if",
      ["==", "n", 0],
      ["'"],
      ["'", "do", ["fizzbuzz_one", "n"], ["run_fizzbuzz", ["-", "n", 1]]]
    ]
  ]
]

(lol) Usage

It's a command line script.

python jsln.py
# or, to evaluate JSON (or JSlN) files you have:
python jsln.py file1.json file2.jsln

Supports ints, strings, floats, bools and None intermittently. Lists are immediately executed function calls. In order to make use of "QExprs", you can create one by making the first list item a single quote:

>>> ["'", "+", 2, 3]
("+", 2, 3)

To see the generous standard library and builtins, you can run the builtin vars function:

>>> ["vars"]
{'+': <function add at...}

No deps, lightning fast. This is probably the best thing I've ever built. Please hire me.

About

JavaScript list Notation (A very serious LISP dialect)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages