Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 975 Bytes

README.md

File metadata and controls

45 lines (32 loc) · 975 Bytes

lispjs Build Status codecov

Simple Lisp implementation in JavaScript. Web REPL demo

Note: this is an experimental library for educational purposes only

Installation

$ git clone https://github.com/amitayh/lispjs
$ cd lispjs
$ npm install

Running tests

$ npm test

Example programs

var lisp = require('./lisp');

// Fibonacci
var fib = [
  // Define fib function
  ['define', 'fib',
    ['lambda', ['n'],
      ['if', ['<', 'n', 2],
        1,
        ['+',
          ['fib', ['-', 'n', 1]],
          ['fib', ['-', 'n', 2]]]]]],

  // Call function
  ['fib', 5]
];

console.log(lisp.run(fib)); // Prints 8

(more examples in here and here)