PC-LISP is an implementation of the
Franz Lisp
In computer programming, Franz Lisp is a discontinued Lisp programming language system written at the University of California, Berkeley (UC Berkeley, UCB) by Professor Richard Fateman and several students, based largely on Maclisp and distribu ...
dialect by Peter Ashwood-Smith.
Version 2.07 was released on 1 February 1986, and version 3.00 was released on 1 February 1990.
A current version is available through GitHub.
Currently, PC-LISP has been ported to 32 & 64 bit versions of
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
Mac
Mac or MAC may refer to:
Common meanings
* Mac (computer), a line of personal computers made by Apple Inc.
* Mackintosh, a raincoat made of rubberized cloth
* Mac, a prefix to surnames derived from Gaelic languages
* McIntosh (apple), a Canadi ...
,
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
NetBSD
NetBSD is a free and open-source Unix-like operating system based on the Berkeley Software Distribution (BSD). It was the first open-source BSD descendant officially released after 386BSD was fork (software development), forked. It continues to ...
.
For NetBSD there also exists ports for
AArch64
AArch64, also known as ARM64, is a 64-bit version of the ARM architecture family, a widely used set of computer processor designs. It was introduced in 2011 with the ARMv8 architecture and later became part of the ARMv9 series. AArch64 allows ...
,
ARMv5/6/7,
PowerPC
PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
,
Motorola 68000
The Motorola 68000 (sometimes shortened to Motorola 68k or m68k and usually pronounced "sixty-eight-thousand") is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Sector ...
,
SPARC/SPARC64,
Alpha
Alpha (uppercase , lowercase ) is the first letter of the Greek alphabet. In the system of Greek numerals, it has a value of one. Alpha is derived from the Phoenician letter ''aleph'' , whose name comes from the West Semitic word for ' ...
and
VAX
VAX (an acronym for virtual address extension) is a series of computers featuring a 32-bit instruction set architecture (ISA) and virtual memory that was developed and sold by Digital Equipment Corporation (DEC) in the late 20th century. The V ...
.
Note that the Franz LISP dialect was the immediate, portable successor to the
ITS version of
Maclisp
Maclisp (or MACLISP, sometimes styled MacLisp or MacLISP) is a programming language, a dialect of the language Lisp. It originated at the Massachusetts Institute of Technology's (MIT) Project MAC (from which it derived its prefix) in the late 19 ...
and is perhaps the closest thing to the LISP in the
Steven Levy
Steven Levy (born 1951) is an American journalist and editor at large for '' Wired'' who has written extensively for publications on computers, technology, cryptography, the internet, cybersecurity, and privacy. He is the author of the 1984 boo ...
book ''
Hackers'' as is practical to operate.
PC-LISP is written primarily in the
C programming language
C (''pronounced'' '' – like the letter c'') is a general-purpose programming language. It was created in the 1970s by Dennis Ritchie and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of ...
, with some parts now also written in
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
.
PC-LISP runs well in
DOS
DOS (, ) is a family of disk-based operating systems for IBM PC compatible computers. The DOS family primarily consists of IBM PC DOS and a rebranded version, Microsoft's MS-DOS, both of which were introduced in 1981. Later compatible syste ...
emulators and on modern Windows versions. Because PC-LISP implements Franz LISP, it is a dynamically scoped predecessor to modern
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
. This is therefore an historically important implementation.
Example
The session is running the following code which demonstrates
dynamic scoping
In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts ...
in Franz LISP. Note that PC-LISP does not implement the
let
special form that
Emacs Lisp
Emacs Lisp is a Lisp dialect made for Emacs.
It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C, as is the Lisp interpreter.
Emacs Lisp code is used to modify, extend and customi ...
provides for local variables. Instead, all variables are what an
ALGOL
ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
-based language would call "global". The first dialect of Lisp to incorporate ALGOL scoping rules (called
lexical scoping
In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts ...
) was
Scheme although the
Common Lisp
Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
language also added this feature.
;; Demonstration of dynamic scoping
;; This is a "global" variable
(setq myglobal "this is my global variable")
;; Another global variable
(setq yourglobal "this is my global variable")
;; a function which prints the symbols
(defun dosomething (mine yours)
(princ " * Mine is - ")
(princ mine)
(princ "\n")
(princ " * Yours is - ")
(princ yours)
(princ "\n"))
;; override the symbols
(defun nolocals ()
(setq mine "I have set mine to a new value")
(setq yours "I have set yours to a new value")
(dosomething mine yours))
(defun main ()
;; define two symbols
(setq mine myglobal)
(setq yours yourglobal)
;; print them
(princ "calling dosomething\n")
(dosomething mine yours)
(princ "calling nolocals\n")
(nolocals)
(princ "calling dosomething again\n")
(dosomething mine yours))
Another example showing the use of backquote and the power of LISP. This is a differentiation example.
; D(e,X) -
; Will compute the symbolic derivative of expression e with respect
; to variable X. We take the expression in standard lisp prefix form and will
; use the following rules of differentiation.
;
; D(x) = 1
; D(a) = 0
; D(ln u) = D(u)/u
; D(u+v) = D(u)+D(v)
; D(u-v) = D(u)-D(v)
; D(u*v) = D(u)*v + u*D(v)
; D(u/v) = D(u)*v + (u*D(v))/v^2
; D(v^u) = (v^u)*(u*D(v)/v + D(u)*ln(v))
;
(defun D(e X &aux u v)
(cond ((equal e X) 1)
((atom e) 0)
(t (setq u (cadr e) v (caddr e))
(caseq (car e)
(ln `(/ ,(D u X) ,u))
(+ `(+ ,(D u X) ,(D v X)))
(- `(- ,(D u X) ,(D v X)))
(* `(+ (* ,(D u X) ,v) (* ,(D v X) ,u)))
(/ `(- (/ ,(D u X) ,v)
(/ (* ,u ,(D v X)) (^ ,v 2))))
(^ `(* ,e (+ (/ (* ,v ,(D u X)) ,u)
(* ,(D v X) (ln ,u)))))
(t (princ "ERROR") (exit)]
References
{{reflist
External links
PC-LISP repositoryvia
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
Packages for NetBSDvia
Pkgsrc
pkgsrc (''package source'') is a package management system for Unix-like operating systems. It was forked from the FreeBSD ports collection in 1997 as the primary package management system for NetBSD. Since then it has evolved independently; in 1 ...
Lisp programming language family
Discontinued development tools