SLisp, standing for Simplified Lisp (or rather Sh*tty Lisp once you get to look at the code), is an interpreter for a simplifed version of Lisp.
Simply clone the directory, and run the following command in the root directory where the pyproject.toml is located.
pip install -e .You can verify that the installation was successful by running the slisp command in the terminal.
There are two ways to run SLisp programs. The first one is via a REPL. To achieve this, simply run the slisp command with no arguments.
~$ slisp
SLISP v0.1.0
>>> (+ 1 2)
3You can also pass in the path to a slisp file as an argument to the slisp command. This will run the file.
~$ slisp test/helloworld.slisp
Hello WorldHere is a simple example of FizzBuzz. There are more examples under the test directory.
(defunc fizzbuzz (n)
(for i (in-range 1 n)
(cond
((= 0 (% i 15))
(print "FizzBuzz")
)
((= 0 (% i 3))
(print "Fizz")
)
((= 0 (% i 5))
(print "Buzz")
)
(True (print i))
)
)
)
;; Run the FizzBuzz game from numbers 1 to 30
(fizzbuzz 31)