Common Lisp Derek Debruin Mark Larue Vinh Doan. Problem Domains There was a need in the early 1960s to define a programming language whose computational.

Slides:



Advertisements
Similar presentations
CS 63 LISP Philip Greenspun's Tenth* Rule of Programming:
Advertisements

Lisp. Versions of LISP Lisp is an old language with many variants Lisp is alive and well today Most modern versions are based on Common Lisp LispWorks.
C-LISP. LISP 2 Lisp was invented by John McCarthy in 1958 while he was at the Massachusetts Institute of Technology (MIT).John McCarthyMassachusetts Institute.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 14 Functional Programming Languages - The design of the imperative languages is based directly.
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
Functional Programming. Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends.
Chapter 3 Functional Programming. Outline Introduction to functional programming Scheme: an untyped functional programming language.
CS 355 – PROGRAMMING LANGUAGES Dr. X. Apply-to-all A functional form that takes a single function as a parameter and yields a list of values obtained.
LISP Programming. LISP – simple and powerful mid-1950’s by John McCarthy at M.I.T. “ LIS t P rocessing language” Artificial Intelligence programs LISP.
Lisp – Introduction יעל נצר מערכות נבונות סמסטר ב' תשס"ו.
1 Functional programming Languages And a brief introduction to Lisp and Scheme.
PZ10CX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ10CX - LISP Programming Language Design and Implementation.
Introduction to Artificial Intelligence Lisp Ruth Bergman Fall 2002.
Lisp. Versions of LISP Lisp is an old language with many variants –LISP is an acronym for List Processing language Lisp is alive and well today Most modern.
Functional programming: LISP Originally developed for symbolic computing Main motivation: include recursion (see McCarthy biographical excerpt on web site).
Lisp A functional language. As always… How is it similar? First it runs on the same OS as all applications Uses runtime activation stack as others Needs.
Chapter 15 Functional Programming Languages. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Introduction Design of imperative languages is.
Artificial Intelligence and Lisp Lecture 6 LiU Course TDDC65 Autumn Semester, 2010
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Functional programming: LISP Originally developed for symbolic computing First interactive, interpreted language Dynamic typing: values have types, variables.
SchemeCOP Introduction to Scheme. SchemeCOP Scheme Meta-language for coding interpreters –“ clean ” semantics Scheme = LISP + ALGOL –simple.
CSE S. Tanimoto Introduction 1 LISP Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that.
Dr. Muhammed Al-Mulhem ICS An Introduction to Functional Programming.
Presentation topic : LISP Amir Shahzad MCS 3 MCC
Lisp by Namtap Tapchareon Lisp Background  Lisp was developed by John McCarthy in  Lisp is derives from List Processing Language. 
CS 152: Programming Language Paradigms February 24 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
CS 363 Comparative Programming Languages
LISP – Not just a Speech Impediment Jim Lowe. Brief History of LISP Initial development begins at the Dartmouth Summer Research Project in 1956 by Dr.
Functional Languages. Why? Referential Transparency Functions as first class objects Higher level of abstraction Potential for parallel execution.
CSC3315 (Spring 2009)1 CSC 3315 Programming Paradigms Scheme Language Hamid Harroud School of Science and Engineering, Akhawayn University
Sigma Lisp Σλ Sam Davis Nick Alexander. What is Sigma Lisp? ● New dialect of Lisp ● Designed to be as expressive as possible.
ISBN Chapter 15 Functional Programming Languages.
ISBN Chapter 15 Functional Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
CS 326 Programming Languages, Concepts and Implementation Instructor: Mircea Nicolescu Lecture 5.
COP4020 Programming Languages Functional Programming Prof. Xin Yuan.
Chapter Fifteen: Functional Programming Languages Lesson 12.
ISBN Chapter 15 Functional Programming Languages.
ISBN Chapter 15 Functional Programming Languages.
CS535 Programming Languages Chapter - 10 Functional Programming With Lists.
1-1 An Introduction to Functional Programming Sept
Scheme Profs Tim Sheard and Andrew Black CS 311 Computational Structures.
Milos Hauskrecht (PDF) Hieu D. Vu (PPT) LISP PROGARMMING LANGUAGE.
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
Functional Programming Part 1. Organization of Programming Languages-Cheng Big Picture u What we’ve learned so far: Imperative Programming Languages 
ISBN Chapter 15 Functional Programming Languages.
CSE 425: Functional Programming I Programs as Functions Some programs act like mathematical functions –Associate a set of input values from the function’s.
C H A P T E R E I G H T Functional Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
LISP LISt Processing. History & Overview b b One of the oldest high level programming languages. b b First developed in 1958 by John McCarthy. b b Later.
Ch Ch jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (n-n-n-notes) Summer 2003 Dr. Carter Tiernan.
Artificial Intelligence and Lisp Lecture 6 LiU Course TDDC65 Autumn Semester,
Functional Programming
Functional Programming Languages
Zuse’s Plankalkül – 1945 Never implemented Problems Zuse Solved
Functional Programming
A I (Artificial Intelligence)
CS 326 Programming Languages, Concepts and Implementation
Scheme : variant of LISP
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
LISP LISt Processing.
PZ10CX - LISP Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section Appendix A.6.
FP Foundations, Scheme In Text: Chapter 14.
Functional Programming Languages
Lisp, Then and Now.
6.001 SICP Variations on a Scheme
LISP LISt Processing.
LISP LISt Processing.
Modern Programming Languages Lecture 18 Fakhar Lodhi
Chapter 15 Functional Programming 6/1/2019.
Lisp.
Presentation transcript:

Common Lisp Derek Debruin Mark Larue Vinh Doan

Problem Domains There was a need in the early 1960s to define a programming language whose computational model could be based on some well characterized mathematical principles rather than on the efficiency of implementation. Lisp become one of the best examples of these language definitions.

John McCarthy Lisp was invented by John McCarthy in the late 1950's as a formalism for reasoning about the use of recursion equations as a model for computation. The name Lisp derives from "List Processing Language". Of computer languages still in widespread use today, only FORTRAN is older.

McCarthy Cont… Around 1956 McCarthy understood the central role of a programming language for his scientific goal -- artificial intelligence. McCarthy desired for an algebraic list processing language for artificial intelligence work on the IBM 704 computer (1958)

Variation in Lisp Since the inception of Lisp many variations have been created. Of each of these variations, there also has been many dialects born. The most widely-known general-purpose Lisp dialects are Common Lisp and Scheme.

Common Lisp Rapid was beneficial in early development, but demand for a standard eventually grew. Developed to standardize the divergent variants of Lisp. It is not an implementation but more of a language specification.

Basic Concepts Everything is a list. Everything. Language can be redefined at run-time. Code is data and can be generated at run- time. –This is one of the primary reasons that Lisp is so popular in artificial intelligence.

Greenspun’s Tenth Rule Any sufficiently complicated C or Fortran program contains an ad-hoc, informally- specified, bug-ridden, slow implementation of half of Common Lisp. Lisp is often considered the “Grand-Daddy of them all.” Many important features of other languages come from Lisp.

Macros Not the same as C’s preprocessor macros Lisp macros formalize the ability of Lisp to implement other languages and to change it’s defined behavior dynamically.

Examples The S-expression is the basic syntax of Lisp: a parenthesized list. (list 1 2 3) The basic definition of a list. (cons 1 2) constructs a basic list with contents (1 2)

Examples (cont.) The car function yields the “head” (first element) of a list: (car (1 2 3)) → 1 The cdr function yields the “tail” (everything following the head) of a list: (tail (1 2 3)) → (2 3)

Examples (cont.) Quoting prevents lists from being evaluated automatically. ‘(one two three) is a quoted list. Quoting prevents the list from being evaluated as three identifiers “ one,” “ two,” and “ three.”

Complete Example An unquoted form is evaluated when encountered and again when used: (setq a ‘b) (setq b ‘c) (eval a) → c

Comparing Lisp to C++ Lisp is a functional programming language; C++ is procedural. This causes Lisp and C++ to have numerous differences in syntax, function definition, typing, etc.

Prefix Syntax Lisp expressions use prefix notation. The expression: (* l 2 3 4) evaluates to 24. The equivalent expression in C++ would use infix notation: 1 * 2 * 3 * 4;

Functions Functions are created through the use of the special operator lambda. lambda takes an argument list and an expression, evaluating the arguments according to the expression. The expression: ((lambda (arg) (* arg 2)) 3) describes a function that takes one argument, 3, and multiplies it by 2, yielding a result of 6.

Functions (cont.) Contrast this with C++, where a function stores an argument which is explicitly manipulated by statements that follow: int lambda( int arg ) { return arg * 2; }

Cons and Implicit Typing Lisp uses lists as its primary data structure. Lists are constructed similarly to other functional languages, using cons, append, etc. Data is implicitly typed in list and can therefore be mixed in a given list. For example, (cons ‘a (2 3)) evaluates to (a 2 3).

Lists and Typing (cont.) In C++ data is explicitly typed. C++ also lacks a primitive list data structure—the closest equivalent is the array, which may contain only one data type. The following code is not valid in C++: int list[3] = {‘a’, 2, 3};

Impact and the Future McCarthy pioneered the if-then-else structure through Lisp’s cond structure Lisp has had a resurgence in popularity lately. The lack of variables in Lisp causes programs without side-effects. This may prove very useful in parallel computing.