Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 986 Bytes

README.md

File metadata and controls

44 lines (33 loc) · 986 Bytes

Elisper

Build Status

An experimental implementation of a subset of lisp in Elixir.

This was mainly a fun project based off of the blog post, Lisp In Your Own Language, by Dan Prince.

Some things that are supported:

Evaluation

iex(2)> Elisper.eval([:+, 1, 1])
2

iex(3)> Elisper.eval([:+, [:+, 2, 2], [:+, 2, 3]])
9

Do Clauses

iex(5)> Elisper.eval([:do, [:print, "hello"], [:print, "world"]])
print function hello
print function world
:ok

If Statements

iex(7)> Elisper.eval([:if, [:=, 1, 1], [:+, 1, 1], [:+, 2, 2]])
2

Functions

iex(9)> Elisper.eval(
...(9)> [:do,
...(9)>       [:def, :multi,
...(9)>         [:fn, [:x, :y],
...(9)>           [:*, :x, :y]
...(9)>         ]
...(9)>       ],
...(9)>       [:multi, 3, 4]
...(9)>      ]
...(9)> )
12