The first LispLanguage compiler was developed by JohnMcCarthy at Dartmouth College between 1955 and 1959. This makes it the second oldest programming language in common use today (only Fortran is older, developed between 1954 and 1957). Lisp went forth and grew many many dialects: the most notable of these are AutoLisp, EmacsLisp, Interlisp, MacLisp, [[Scheme]] and Common Lisp. Around 1980, there were many dialects of Lisp in development: Interlisp at Xerox, MacLisp, Lisp Machine Lisp and NIL ("New Implementation of Lisp") at MIT, Portable Standard Lisp, SpiceLisp at CMU, S-1 Lisp at Stanford and others. There was clearly a need for a standard. RichardGabriel, JonWhite, GuySteele and DavidMoon were the driving force behind the standardization effort, which resulted in 1984 in GuySteele's book CommonLispTheLanguage which set out a design for the new language CommonLisp; in 1986 the ANSI standardization committee (X3J13) was working; and in 1994 the ANSI CommonLisp standard was released. By the late 1990s, most commercial Lisp vendors had adopted CommonLisp. (AutoLisp remains a holdout.) The CommonLisp standard is available online as the CommonLispHyperspec. See https://common-lisp.net/ or https://lisp-lang.org/ for a list of free and proprietary implementations for different platforms. == What are some differences between Elisp and Common Lisp? == First, the two languages are very similar: they are Lisp-2, they have defun, defmacro, defvar, let… one shouldn't feel alienated when going from Elisp to Common Lisp. Still, there are some remarkable differences: * CL has namespaces (called a package) * CL has keyword arguments to functions * CL uses lexical scoping by default * most CL implementations do tail call optimization, while Emacs 28 can do it with named-let or a specific package (tco.el). * CL has good threads support (see the bordeaux-threads library, lparallel or again the sento actor library, and more) * CL has a famous built-in object system (CLOS) and a meta-object protocol (MOP). Emacs' eieio library is modeled after it. * it is possible to compile one's program more incrementally in CL than in Elisp, such as function by function (C-c C-c in Slime). * some CL implementations, such as SBCL, bring more type warnings and errors at compile time (on a C-c C-c keypress) than Elisp. * there is also a library named Coalton that brings Haskell-like type checking on top of CL. * believe it or not but developing in CL in Emacs is richer than developing with Elisp: compile one function, send a function to the REPL, print the argument list, interactively inspect objects, use cross-referencing (who is calling/using/defining… a function, a variable, a macro, a method), work with the interactive debugger… * CL has a rich and complex error handling system that, coupled with the interactive debugger, allows to restart computation from an individual frame, or to handle a condition (an exception) without unwinding the stack. * CL has different implementations with different strengths, and libraries on a wider variety of domains. * it is possible to build a binary of a CL program. SBCL compiles to machine code. * Elisp's edebug, when on a break-point, shows the value of the variable at point. Surprisingly this has turned difficult to get in CL, except with the proprietary `LispWorks' editor and Sly stickers that approach it. * CL doesn't have `defadvice' (but some implementations might have a non-portable version of it). They also have some semantic differences: * the "else" branch of elisp's `if' is an implicit progn, it accepts multiple forms. In CL, both the "then" and "else" branches accept only one expression, so one must group multiple expressions in a `progn'. == Why isn't more of CommonLisp in GNU Emacs? == EmacsLisp predates the CommonLisp standard; it is a MacLisp derivative. Changing Emacs to use CommonLisp would require a number of significant and incompatible changes, most notably: * The package system. * Lexical scoping for variables by default. * Keyword arguments to functions. * Closures. RichardStallman has chosen not to adopt CommonLisp. He said in [http://mail.gnu.org/archive/html/emacs-devel/2003-08/msg00436.html this post, 2003-08-31] on the [http://savannah.gnu.org/mail/?group_id=40 emacs-devel mailing list], when asked to include a large part of the cl package into the EmacsLisp core: I am willing to consider a small number of functions for inclusion as standard parts of Emacs. I don't have time to consider a large number, and I can't agree to them without considering them. I do not like the Common Lisp style of using keyword arguments for many common functions. I basically do not have a very high opinion of many of the decisions that were made in Common Lisp. == How to use CommonLisp in Emacs Programs == See CommonLispForEmacs. == Using Emacs as an interface to your CommonLisp system == Emacs has a simple interface to a running Lisp top-level. Use `M-x run-lisp'. This will run the `lisp' program on your system. See the (emacs)Running an External Lisp. node of the EmacsManual for details. If your program is not called `lisp' but `sbcl' or `clisp' or whatever, customize the option `inferior-lisp-program'. For a really good interface to an external lisp, check SlimeMode. Other useful packages include: * CommonLispHyperspec -- lookup functions and variables in the spec * CommonLispTheLanguage -- lookup functions and variables in the book * SlyMode -- a fork of Slime with some added features, like back references in the REPL and Sly Stickers, for debugging. * the slime-star extensions: https://github.com/mmontone/slime-star * emacs4cl: https://github.com/susam/emacs4cl a small Emacs init file to quickly setup vanilla setup for Common Lisp programming. * Portacle: https://shinmera.github.io/portacle/ a portable version of Emacs that ships with SBCL (Common Lisp implementation), Quicklisp (the library manager), Slime, Git and some useful utilities (tree view, etc). == Using EmacsLisp Code in your CommonLisp implementation == There is CommonLisp code by SamSteingold out there that can read EmacsLisp. See [http://clocc.cvs.sourceforge.net/clocc/clocc/src/cllib/elisp.lisp?view=markup elisp.lisp] for the code. http://clocc.sourceforge.net/ == Emacs implementations written in Common Lisp == See CommonLispEmacs. == References == * [http://www.cliki.net/index The Common Lisp Wiki] * [http://www-formal.stanford.edu/jmc/history/lisp/lisp.html John McCarthy, History of Lisp] * [http://www.elwoodcorp.com/alu/table/Lisp-History.html Kent Pitman, Brief History of the Lisp Language] * [http://www-2.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html Guy L Steele, Common Lisp: The Language, 2nd Edition] * [http://www8.informatik.uni-erlangen.de/html/lisp/histlit1.html Herbert Stoyan, Early LISP History (1956-1959)] * [https://lispcookbook.github.io/cl-cookbook/ the Common Lisp Cookbook] * [https://github.com/CodyReichert/awesome-cl awesome-cl] ---- CategoryCode