Transcript
Page 1: LISP – Not just a Speech Impediment

LISP – Not just a Speech LISP – Not just a Speech ImpedimentImpediment

Jim LoweJim Lowe

Page 2: LISP – Not just a Speech Impediment

Brief History of LISPBrief History of LISP• Initial development begins at the Dartmouth Initial development begins at the Dartmouth

Summer Research Project in 1956 by Dr John Summer Research Project in 1956 by Dr John McCarthy.McCarthy.

• At the time, Fortran was the only high level At the time, Fortran was the only high level programming language available. programming language available.

• Dr. McCarthy and his colleagues were interested in Dr. McCarthy and his colleagues were interested in producing a language more suited for manipulating producing a language more suited for manipulating data in a similar manner to human data in a similar manner to human thought….Artificial Intelligence.thought….Artificial Intelligence.

• Language development was completed at MIT and Language development was completed at MIT and was made available to the general computer science was made available to the general computer science community in 1963.community in 1963.

Page 3: LISP – Not just a Speech Impediment

Innovations of LISPInnovations of LISP• First functional language.First functional language.

– Emphasis is on the evaluation of expressions rather than Emphasis is on the evaluation of expressions rather than the execution of commands.the execution of commands.

• RecursionRecursion– The concept of a function calling itself until a predefined The concept of a function calling itself until a predefined

base case was reached was a significant step forward in base case was reached was a significant step forward in CS. LISP memory management was developed to allow for CS. LISP memory management was developed to allow for recursion.recursion.

– Recursion was a mathematical concept applied to a Recursion was a mathematical concept applied to a computer.computer.

• Object OrientationObject Orientation– The basic unit of data in LISP is a list. This data structure is The basic unit of data in LISP is a list. This data structure is

ideally suited for definition of a weak typed object. For ideally suited for definition of a weak typed object. For example, animals could be defined as;example, animals could be defined as;

• (animals ‘(cat brown) (dog white) (bird purple))(animals ‘(cat brown) (dog white) (bird purple))

• (animals ‘(cat brown dumb) (dog white smart))(animals ‘(cat brown dumb) (dog white smart))

Page 4: LISP – Not just a Speech Impediment

Inovations of LISP (cont.)Inovations of LISP (cont.)

• Object Orientation (cont)Object Orientation (cont)– This concept was developed to provide for programming a This concept was developed to provide for programming a

computer to think like a human computer to think like a human – Functions can be defined as objects and passed as arguments. Functions can be defined as objects and passed as arguments.

• Garbage CollectionGarbage Collection– Memory management was handled by the interpreter.Memory management was handled by the interpreter.

• Conditionals Conditionals – A conditional is an if-then-else construct. We take these for A conditional is an if-then-else construct. We take these for

granted now. granted now. – FORTRAN used GOTO FORTRAN used GOTO

• Variables Variables – In LISP all variables are pointers, this allowed for the reduction In LISP all variables are pointers, this allowed for the reduction

of data storage requirements for recursive functions.of data storage requirements for recursive functions.

Page 5: LISP – Not just a Speech Impediment

LISP BNF GrammarLISP BNF Grammar

• All LISP expressions built from simple grammar All LISP expressions built from simple grammar rulesrules– Atom = NULL OR Letter OR NumberAtom = NULL OR Letter OR Number– Letter = “A” OR “B” OR “C”….OR “Z”Letter = “A” OR “B” OR “C”….OR “Z”– Number = “0” OR “1” or “2” …OR “9”Number = “0” OR “1” or “2” …OR “9”– S-Expression = Atom OR (S-Expression “.” S-Expression) S-Expression = Atom OR (S-Expression “.” S-Expression)

OR List.OR List.– List = ‘({S-Expression “ “}* )List = ‘({S-Expression “ “}* )– NULL = “”NULL = “”

• Atoms can be used to represent values and passed Atoms can be used to represent values and passed as these values. For example we may need to as these values. For example we may need to define PI to equal 3.1415 or FRED to equal “Fredrick define PI to equal 3.1415 or FRED to equal “Fredrick the 3rd of Nowhere.” To do this, LISP binds a value the 3rd of Nowhere.” To do this, LISP binds a value to the variable representation. With the function to the variable representation. With the function “setq”.“setq”.

Page 6: LISP – Not just a Speech Impediment

Functionality of LISPFunctionality of LISP

• LISP can be compiled or interpreted.LISP can be compiled or interpreted.– Early LISPEarly LISP was interpreted only. This was of particular was interpreted only. This was of particular

importance due to a complete lack of computer operating importance due to a complete lack of computer operating system standardization.system standardization.

– Later versions (c. 1968) provided for compilation to take Later versions (c. 1968) provided for compilation to take advantage of LISP machines. LISP Machines were advantage of LISP machines. LISP Machines were computers built solely to execute LISP instructions.computers built solely to execute LISP instructions.

• Variable visibility is limited to descendants from Variable visibility is limited to descendants from point of definitionpoint of definition

• There is no real distinction between read-time, There is no real distinction between read-time, compile-time, and runtime. compile-time, and runtime. – You can compile or run code while reading, read or run You can compile or run code while reading, read or run

code while compiling, and read or compile code at code while compiling, and read or compile code at

runtime.runtime.

Page 7: LISP – Not just a Speech Impediment

LISP todayLISP today

• LISP is currently standardized in many different LISP is currently standardized in many different forms.forms.– ANSI standard X3.226ANSI standard X3.226– ISI (International Standards Institute) 13816.1997ISI (International Standards Institute) 13816.1997– Many of the descendants of LISP are also standardized.Many of the descendants of LISP are also standardized.

• Scheme : Educational and Research language.Scheme : Educational and Research language.

• Arc : A modern LISP derivative.Arc : A modern LISP derivative.

• AutoLISP : A dialect used for CAD applications.AutoLISP : A dialect used for CAD applications.

• Dylan : An object-oriented dialect of LISP.Dylan : An object-oriented dialect of LISP.

• Emacs LISP : Text editor extension language.Emacs LISP : Text editor extension language.

Page 8: LISP – Not just a Speech Impediment

Advantages of LISPAdvantages of LISP

• Programs are easy to test due to interactive Programs are easy to test due to interactive interpreter environment.interpreter environment.

• Portable across hardware platforms with Portable across hardware platforms with supported interpreters.supported interpreters.

• Clear and concise syntax and semantics.Clear and concise syntax and semantics.

• Automatic memory management and garbage Automatic memory management and garbage collection.collection.

• Packaging of programs into modules.Packaging of programs into modules.

• Flexible data structures.Flexible data structures.

• Object oriented capability.Object oriented capability.

Page 9: LISP – Not just a Speech Impediment

Disadvantages of LISPDisadvantages of LISP

• Limited availability of compilers – Increased Limited availability of compilers – Increased program size and run time.program size and run time.

• Cross platform compatibility requires multiple Cross platform compatibility requires multiple interpreter environments.interpreter environments.

• Small install base creates limited audience for Small install base creates limited audience for programs.programs.

• Other computer programmers make fun of you Other computer programmers make fun of you because you “talk” funny.because you “talk” funny.


Recommended