Giter Site home page Giter Site logo

seipy / lisp-rosetta-stone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eatonphil/lisp-rosetta-stone

0.0 1.0 0.0 15 KB

A lisp rosetta stone to demonstrate modern language features

Java 17.49% Common Lisp 0.41% JavaScript 18.58% TypeScript 15.37% C# 16.79% Go 15.16% Python 16.20%

lisp-rosetta-stone's Introduction

Rosetta Stone for Modern Languages

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.

Code golf

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#.

Java

247 lines of code.

$ cd java
$ javac Main.java
$ java -cp . Main "$(cat ../test.lisp)"
144

C#

246 lines of code.

$ cd csharp
$ dotnet run "$(cat ../test.lisp)"
144

TypeScript

253 lines of code.

$ cd typescript
$ yarn
$ yarn tsc lisp.ts
$ node lisp.js "$(cat ../test.lisp)"
144

Go

272 lines of code.

$ cd go
$ go run lisp.go "$(cat ../test.lisp)"
144

Python

264 lines of code.

$ cd python
$ python lisp.py "$(cat ../test.lisp)"
144

lisp-rosetta-stone's People

Contributors

eatonphil avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.