Measures Concepts
GitHub icon

Common Lisp

Common Lisp - Programming language

< >

Common Lisp is a programming language created in 1984 by Scott Fahlman and Richard P. Gabriel and David A. Moon and Kent Pitman and Guy Steele and Dan Weinreb.

#87on PLDB 40Years Old 24kRepos

Try now: Riju

Common Lisp (CL) is a dialect of the Lisp programming language, published in ANSI standard document ANSI INCITS 226-1994 (R2004) (formerly X3.226-1994 (R1999)). The Common Lisp HyperSpec, a hyperlinked HTML version, has been derived from the ANSI Common Lisp standard. The Common Lisp language was developed as a standardized and improved successor of Maclisp. Read more on Wikipedia...


Example from Riju:
(format t "Hello, world!")
Example from hello-world:
(defun hello-world () (format t "Hello World~%")) (hello-world)
Example from Linguist:
(DEFUN HELLO () (PRINT 'HELLO))
Example from Wikipedia:
CL-USER > (available-shells) (#P"/bin/bash" #P"/bin/csh" #P"/bin/ksh" #P"/bin/sh" #P"/bin/tcsh" #P"/bin/zsh")

Language features

Feature Supported Token Example
Print() Debugging ✓ PRINT
Line Comments ✓ ;
; A comment
Multiple Inheritance ✓
Directives ✓
Comments ✓
Multiple Dispatch ✓
 (defmethod collide-with ((x asteroid) (y asteroid))
  ;; deal with asteroid hitting asteroid
  )
(defmethod collide-with ((x asteroid) (y spaceship))
  ;; deal with asteroid hitting spaceship
  )
(defmethod collide-with ((x spaceship) (y asteroid))
  ;; deal with spaceship hitting asteroid
  )
(defmethod collide-with ((x spaceship) (y spaceship))
  ;; deal with spaceship hitting spaceship
  )
Single Dispatch ✓
; https://eli.thegreenplace.net/2016/a-polyglots-guide-to-multiple-dispatch-part-3/
(defclass Person () ())
(defmethod frobnicate ((p Person) record spreadsheet)
 (format t "~a ~a ~a~&" (type-of p) (type-of record) (type-of spreadsheet)))
(defclass Asteroid () ())
(defmethod frobnicate ((a Asteroid) velocity size)
 ; do stuff
 )
; At runtime these 2 would be routed to respective methods:
(frobnicate a-person his-record big-spreadsheet)
(frobnicate an-asteroid very-fast pretty-small)
Lispy ✓
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout