This repo contains implementations of a tree-walking lisp interpreter capable of running the following program:
(def fib (lambda (n)
(if (<= n 2)
1
(+ (fib (- n 1)) (fib (- n 2))))))
(fib 12)
And it should print out 144
as the result.
This is not code golfing! The idea is to produce some decent idiomatic code for a similar project and compare verbosity. My thesis is that modern Java and C# aren't really that much more verbose than Python or JavaScript. And also that Go is probably more verbose than Java or C#.
247 lines of code.
$ cd java
$ javac Main.java
$ java -cp . Main "$(cat ../test.lisp)"
144
246 lines of code.
$ cd csharp
$ dotnet run "$(cat ../test.lisp)"
144
253 lines of code.
$ cd typescript
$ yarn
$ yarn tsc lisp.ts
$ node lisp.js "$(cat ../test.lisp)"
144
272 lines of code.
$ cd go
$ go run lisp.go "$(cat ../test.lisp)"
144
264 lines of code.
$ cd python
$ python lisp.py "$(cat ../test.lisp)"
144