Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences between Clojure, Scheme/Racket and Common Lisp?

People also ask

What are the differences between Lisp Scheme and racket?

Racket is a descendant of Scheme, which in turn is a descendant of Lisp. So while Racket is not Lisp (in the specific Common Lisp sense), it is a Lisp (in the familial sense). Its core ideas—and core virtues—are shared with Lisp. So talking about Racket means talking about Lisp.

What is the difference between Scheme and racket?

Racket is a fork of Scheme, the simple language at the core of this course for many years. Scheme was created primarily as an experiment in understanding how programming languages work. Racket retains its basic favor, but it also adds many, many features that make the language useful in the 21st century.

Is Lisp and racket the same?

The Racket language is a modern dialect of Lisp and a descendant of Scheme. It is designed as a platform for programming language design and implementation.

Should I learn racket or Clojure?

>>Racket is good but the toolchain and libraries are far behind Clojure. Plus they plan to deprecate the entire language's syntax in the near future. Clojure is the way to go. It might not be perfect.


They all have a lot in common:

  • Dynamic languages
  • Strongly typed
  • Compiled
  • Lisp-style syntax, i.e. code is written as a Lisp data structures (forms) with the most common pattern being function calls like: (function-name arg1 arg2)
  • Powerful macro systems that allow you to treat code as data and generate arbitrary code at runtime (often used to either "extend the language" with new syntax or create DSLs)
  • Often used in functional programming style, although have the ability to accommodate other paradigms
  • Emphasis in interactive development with a REPL (i.e. you interactively develop in a running instance of the code)

Common Lisp distinctive features:

  • A powerful OOP subsystem (Common Lisp Object System)
  • Probably the best compiler (Common Lisp is the fastest Lisp according to http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html although there isn't much in it.....)

Clojure distinctive features:

  • Largest library ecosystem, since you can directly use any Java libraries
  • Vectors [] and maps {} used as standard in addition to the standard lists () - in addition to the general usefullness of vectors and maps some believe this is a innovation which makes generally more readable
  • Greater emphasis on immutability and lazy functional programming, somewhat inspired by Haskell
  • Strong concurrency capabilities supported by software transactional memory at the language level (worth watching: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey)

Scheme distinctive features:

  • Arguably the simplest and easiest to learn Lisp
  • Hygienic macros (see http://en.wikipedia.org/wiki/Hygienic_macro) - elegantly avoids the problems with accidental symbol capture in macro expansions

The people above missed a few things

  1. Common Lisp has vectors and hash tables as well. The difference is that Common Lisp uses #() for vectors and no syntax for hash tables. Scheme has vectors, I believe

  2. Common Lisp has reader macros, which allow you to use new brackets (as does Racket, a descendant of Scheme).

  3. Scheme and Clojure have hygienic macros, as opposed to Common Lisp's unhygienic ones

  4. All of the languages are either modern or have extensive renovation projects. Common Lisp has gotten extensive libraries in the past five years (thanks mostly to Quicklisp), Scheme has some modern implementations (Racket, Chicken, Chez Scheme, etc.), and Clojure was created relatively recently

  5. Common Lisp has a built-in OO system, though it's quite different from other OO systems you might have used. Notably, it is not enforced--you don't have to write OO code.

  6. The languages have somewhat different design philosophies. Scheme was designed as a minimal dialect for understanding the Actor Model; it later became used for pedagogy. Common Lisp was designed to unify the myriad Lisp dialects that had sprung up. Clojure was designed for concurrency. As a result, Scheme has a reputation of being minimal and elegant, Common Lisp of being powerful and paradigm-agnostic (functional, OO, whatever), and Clojure of favoring functional programming.


Don't forget about Lisp-1 and Lisp-2 differences.

Scheme and Clojure are Lisp-1:
That means both variables and functions names resides in same namespace.

Common Lisp is Lisp-2:
Function and variables has different namespaces (in fact, CL has many namespaces).