Languages using Prefix or Postfix Only
Prefix: LISP
LISP (1958) =
- LISt Processing
- Lost In Single Parentheses
50th anniversary of LISP
- recursive definitions
- lists as data structure for symbolic processing
- widely used in AI
- introduced automated memory management
- garbage collection - 40 years before it entered mainstream
(defun factorial (n) (if (<= n 1) 1 (* n (factorial (- n 1)))))
Postfix: PostScript
PostScript (1982)
An example from The Blue Book
%!PS-Adobe-2.0 %%Title: Blue Book Program 1, on page 133 %%Creator: Adobe Systems Incorporated %%CreationDate: Thu Dec 28 13:14:59 PST 1989 %%EndComments /inch {72 mul} def /wedge { newpath 0 0 moveto 1 0 translate 15 rotate 0 15 sin translate 0 0 15 sin -90 90 arc closepath } def gsave 3.75 inch 7.25 inch translate 1 inch 1 inch scale wedge 0.02 setlinewidth stroke grestore gsave 4.25 inch 4.25 inch translate 1.75 inch 1.75 inch scale 0.02 setlinewidth 1 1 12 { 12 div setgray gsave wedge gsave fill grestore 0 setgray stroke grestore 30 rotate } for grestore showpage
Save the above program as .ps file and run e.g. 'gv' on it
Other examples: Program 11 Program 14