SlideShare a Scribd company logo
Lisp andLisp and
Scheme IScheme I
Versions of LISPVersions of LISP
• LISP is an acronym for LISt Processing language
• Lisp is an old language with many variants
– Fortran is the only older language still in wide use
– Lisp is alive and well today
• Most modern versions are based on Common Lisp
• Scheme is one of the major variants
– We will use Scheme, not Lisp, in this class
– Scheme is used for CS 101 in quite a few Universities
• The essentials haven’t changed much
LISP FeaturesLISP Features
• S-expression as the universal data type
– Atoms are similar to identifiers, but can also be numeric constants
– Lists can be lists of atoms, lists, or any combination of the two
• Functional Programming Style - computation is done by
applying functions to arguments, functions are first class
objects, minimal use of side-effects
• Uniform Representation of Data & Code – e.g., (A B C D) is
– A list of four elements (interpreted as data)
– An application of the function ‘A’ to the three parameters B, C, and D
(interpreted as code)
• Reliance on Recursion – iteration is provided too, but recursion
is considered more natural.
• Garbage Collection – frees programmers explicit memory
management.
What’s Functional Programming?What’s Functional Programming?
• FP: computation is applying functions to data
• Imperative or procedural programming: a
program is a set of steps to be done in order
• FP eliminates or minimizes side effects and
mutable objects that create/modify state
–E.g., consider f1( f2(a), f2(b))
• FP treats functions as objects that can stored,
passed as arguments, composed, etc.
Pure Lisp and Common LispPure Lisp and Common Lisp
• Lisp has a small and elegant conceptual core
that has not changed much in almost 50 years.
• McCarthy’s original Lisp paper defined all of
Lisp using just seven primitive functions
• Common Lisp was developed in the 1908s as
an ANSI standard for Lisp
• It is large (> 800 built-in functions), has all the
modern data-types, good programming
environments, and good compilers.
SchemeScheme
• Scheme is a dialect of Lisp that is favored by
people who teach and study programming
languages
• Why?
–It’s simpler and more elegant than Lisp
–It’s pioneered many new programming language
ideas (e.g., continuations, call/cc)
–It’s influenced Lisp (e.g., lexical scoping of variables)
–It’s still evolving, so it’s a good vehicle for new ideas
But I wanted to learn Lisp!But I wanted to learn Lisp!
• Lisp is used in many practical systems, but
Scheme is not
• Learning Scheme is a good introduction to Lisp
• We can only give you a brief introduction to
either language, and at the core, Scheme and
Lisp are the same
• We’ll point out some differences along the way
DrScheme and MzSchemeDrScheme and MzScheme
• We’ll use the PLT Scheme system developed by
a group of academics (Brown, Northeastern,
Chicago, Utah)
• It’s most used for teaching introductory CS
courses
• MzScheme is the basic scheme engine and can
be called from the command line and assumes
a terminal style interface
• DrScheme is a graphical programming
environment for Scheme
mzschememzscheme
drschemedrscheme
Informal SyntaxInformal Syntax
• An atom is either an integer or an identifier.
• A list is a left parenthesis, followed by zero or
more S-expressions, followed by a right
parenthesis.
• An S-expression is an atom or a list.
• Example: (A (B 3) (C) ( ( ) ) )
Hello WorldHello World
(define (helloWorld)
;; prints and returns the message.
(printf “Hello Worldn”))
REPLREPL
• Lisp and Scheme are interactive and use what
is known as the “read, eval, print loop”
–While true
• Read one expression from the open input
• Evaluate the expression
• Print it’s returned value
• (define (repl) (print (eval (read))) (repl))
What is evaluation?What is evaluation?
• Scheme has a set of rules that say how to
evaluate an s-expression
• We will get to these very soon
Built-in Scheme DatatypesBuilt-in Scheme Datatypes
Basic Datatypes
• Booleans
• Numbers
• Strings
• Procedures
• Symbols
• Pairs and Lists
The Rest
• Bytes and Byte
Strings
• Keywords
• Characters
• Vectors
• Hash Tables
• Boxes
• Void and Undefined
Lisp: T and NILLisp: T and NIL
• NIL is the name of the empty list, ( )
• As a test, NIL means “false”
• T is usually used to mean “true,” but…
• …anything that isn’t NIL is “true”
• NIL is both an atom and a list
–it’s defined this way, so just accept it
Scheme: #t, #f, and ‘()Scheme: #t, #f, and ‘()
• So, the boolean datatype in scheme includes #t
and #f
• Scheme represents empty lists as the literal ‘( )
• #t is a special symbol that represents true
• #f represents false
• But in practice, anything that is not equal to #f
is true
• Booleans evaluate to themselves
NumbersNumbers
• Scheme has integers (42) and floats (3.14)
• But also rational numbers
–(/ 1 3) => 1/3
• Complex numbers
• and infinite precision integers
• Numbers evaluate to themselves
StringsStrings
• Strings are fixed length arrays of characters
–“foo”
–“foo barn”
–“foo ”bar””
• Strings evaluate to themselves
PredicatesPredicates
• A predicate (in any computer language) is a function
that returns either “true” or “false”
• In Lisp,
–“false” is represented by #f
–“true” is represented by anything that isn’t #t
• Hence, a Lisp predicate returns either #f or
something else
–Predicates often return “true” values other than
#t, especially if the returned value might be useful
–E.g. (member ‘c ‘(a b c d e f)) returns ‘(d e f))
Function calls and dataFunction calls and data
• A function call is written as a list
– the first element is the name of the function
– remaining elements are the arguments
• Example: (F A B)
– calls function F with arguments A and B
• Data is written as atoms or lists
• Example: (F A B) is a list of three elements
– Do you see a problem here?
QuotingQuoting
• Is (F A B) a call to F, or is it just data?
• All literal data must be quoted (atoms, too)
• (QUOTE (F A B)) is the list (F A B)
– QUOTE is not a function, but a special form
– The arguments to a special form are not
evaluated or evaluated in some special manner
• '(F A B) is another way to quote data
– There is just one single quote at the beginning
– It quotes one S-expression
SymbolsSymbols
• Symbols are atomic names
> ’foo
foo
> (symbol? ‘foo)
#t
• Symbols are used as names of variables and
procedures
–(define foo 100)
–(define (add2 x) (+ x 2))
Basic FunctionsBasic Functions
• CAR returns the head of a list
(car ‘(1 2 3)) => 1
(first ‘(1 2 3)) => 1 ;; for people who don’t like car
• CDR returns the tail of a list
(cdr ‘(1 2 3)) => (2 3)
(rest ‘(1 2 3)) => (2 3) ;; for people who don’t like cdr
• CONS inserts a new head into a list
(cons 1 ‘(2 3)) => (1 2 3)
More Basic FunctionsMore Basic Functions
• EQ? compares two atoms for equality
(eq ‘foo ‘foo) => #t, (eq ‘foo ‘bar) => #f
• ATOM tests if its argument is an atom
(atom ‘foo) => #t, (atom ‘(1 2)) => #f
Other useful FunctionsOther useful Functions
• (NULL? S) tests if S is the empty list
– (NULL? ‘(1 2 3) => #f
– (NULL? ‘()) => #t
• (LIST? S) tests if S is a list
– (listp ‘(1 2 3)) =>#t
– (listp ‘3) => #f
More useful FunctionsMore useful Functions
• LIST makes a list of its arguments
– (LIST 'A '(B C) 'D) => (A (B C) D)
– (LIST (CDR '(A B)) 'C) => ((B) C)
• Note that the parenthesized prefix notation makes it
easy to define functions that take a varying number or
arguments.
– (LIST ‘A) => (A)
– (LIST) => ( )
More useful FunctionsMore useful Functions
APPEND concatenates two lists
– (APPEND ‘(1 2) ‘(3 4)) => (1 2 3 4)
– (APPEND '(A B) '((X) Y)) => (A B (X) Y)
– (APPEND ‘( ) ‘(1 2 3)) => (1 2 3)
– (APPEND NIL NIL NIL) => NIL
Dotted PairsDotted Pairs
• The second argument to CONS can be:
– A list: the result is always another list
– An atom: the result is a dotted pair
• CONS of A and B is (A . B)
– (CAR ‘(A . B)) => A
– (CDR ‘(A . B)) => B
EQUAL? and EQ?EQUAL? and EQ?
• EQUAL? tests whether two s-expressions are
“the same”.
– (equal ‘(a b (c)) ‘(a b (c))) => #t
– (equal ‘(a (b) c) ‘(a b (c))) => #f
• EQ? tests whether two symbols are equal
– (eq ‘foo ‘foo) => #t
– (eq ‘foo ‘bar) => #f
• EQ? is just a pointer test, like Java’s ‘=‘
• EQUAL? compares two complex objects, like a Java
object’s equal method
ATOMATOM
• ATOM takes any S-expression as an argument
• ATOM returns “true” if the argument you gave
it is an atom
• As with any predicate, ATOM returns either
NIL or something that isn't NIL
CONDCOND
• COND implements the
if...then...elseif...then...elseif...then...
control structure
• The arguments to a function are evaluated
before the function is called
– This isn't what you want for COND
• COND is a special form, not a function
Special formsSpecial forms
• A function always evaluates all of its
arguments
• A special form is like a function, but it
evaluates the arguments as it needs them
• IF, COND, QUOTE and DEFINE are special
forms
• Scheme and Lisp lets you define your own
special forms
• We won't be defining special forms in this
course
Form of theForm of the CONDCOND
(COND
(condition1 result1 )
(condition2 result2 )
. . .
(T resultN ) )
Cond ExampleCond Example
(cond ((not (number? x))
0)
((< x 0) 0)
((< x 10) x)
(#t 10))
(if (not (number? x))
0
(if (<x 0)
0
(if (< x 10)
x
10)))
IFIF
• In addition to COND, Lisp and Scheme have an
IF special form that does much the same thing
• Note: IF is a function that returns a value.
• (IF <test> <then> <else>)
– (IF (< 4 6) ‘foo ‘bar) => foo
– (IF (< 4 2) ‘foo ‘bar) => bar
• (IF <test> <then>)
– (IF (= 1 (+ 2 1)) ‘foo) => #f
Defining FunctionsDefining Functions
(DEFINE (function_name . parameter_list)
. function_body )
• Examples:
;; Test if the argument is the empty list
(DEFUN NULL (X) (IF X NIL T))
;; Square a number
(defun square (n) (* n n))
;; absolute difference between two numbers.
(defun diff (x y) (if (> x y) (- x y) (- y x)))
Example: MEMBERExample: MEMBER
• As an example we define MEMBER, which tests
whether an atom is in a list of atoms
(DEFUN MEMBER (X LIST)
;; X is a top-level member of a list if it is the first
;; element or if it is a member of the rest of the list.
(COND ((NULL LIST) NIL)
((EQUAL X (CAR LIST)) T)
(T (MEMBER X (CDR LIST))) ) )
• MEMBER is typically a built-in function
Example: MEMBERExample: MEMBER
• Here’s how MEMBER is actually defined:
(DEFUN MEMBER (X LIST)
(COND ((NULL LIST) NIL)
((EQUAL X (CAR LIST)) LIST)
(T (MEMBER X (CDR LIST))) ) )
• Note that it returns NIL (if the 1st
arg not
found) or the sublist starting with the 1st
arg.
Why?
AppendAppend
• (append ‘(1 2 3) ‘(a b)) => (1 2 3 a b)
• Here are two versions, using if and cond:
(defun append (l1 l2)
(if (null l1)
l2
(cons (car l1) (append (cdr l1) l2)))))
(defun append (l1 l2)
(cond ((null l1) l2)
(t (cons (car l1)
(append (cdr l1) l2)))))
Example: SETSExample: SETS
• Suppose we implement sets and set operationsSuppose we implement sets and set operations
(union, intersection, difference)(union, intersection, difference)
• We could treat a set as just a list and implementWe could treat a set as just a list and implement
the operations so that they enforce uniquenessthe operations so that they enforce uniqueness
of membership.of membership.
• Here is set-addHere is set-add
(defun set-add (thing set)
;; returns a set formed by adding THING to set SET
(if (member thing set) set (cons thing set)))
Example: SETSExample: SETS
• Union is only slightly more complicatedUnion is only slightly more complicated
(defun union (S1 S2)
;; returns the union of sets S1 and S2
(if (null S1)
S2
(add-set (car S1)
(union (cdr S1) S2)))
Example: SETSExample: SETS
• And intersection is also simpleAnd intersection is also simple
(defun intersection (S1 S2)
;; returns the intersection of sets S1 and S2
(cond ((null s1) nil)
((member (car s1) s2)
(intersection (cdr s1) s2))
(T (cons (car s1)
(intersection (cdr s1) s2)))))
ReverseReverse
• Reverse is another common operation on Lists
• It reverses the “top-level” elements of a list
– Speaking more carefully, it constructs a new list equal to it’s
argument with the top level elements in reverse order.
• (reverse ‘(a b (c d) e)) => (e (c d) b a)
(defun reverse (L)
(if (null L)
NIL
(append (reverse (cdr L)) (list (car L))))
Reverse is NaïveReverse is Naïve
• The previous version is often called naïve
reverse because it’s so inefficient?
• What’s wrong with it?
• It has two problems
–The kind of recursion it does grows the stak when it
does not need to
–It ends up making lots of needless copies of parts of
the list
Tail Recursive ReverseTail Recursive Reverse
• The way to fix the first problem is to employ tail
recursion
• The way to fix the second problem is to avoid append.
• So, here is a better reverse:
(defun reverse2 (L) (reverse-sub L NIL))
(defun reverse-sub (L answer)
(if (null L)
answer
(reverse-sub (cdr L)
(cons (car L) answer))))
Still more useful functionsStill more useful functions
• (LENGTH L) returns the length of list L
– The “length” is the number of top-level elements
in the list
• (RANDOM N) , where N is an integer, returns
a random integer >= 0 and < N
• EQUAL tests if two S-expressions are equal
– If you know both arguments are atoms, use EQ
instead
Programs on filePrograms on file
• Use any text editor to create your program
• Save your program on a file with the
extension .lsp
• (Load ‘foo) loads foo.lsp
• (load “foo.bar”) loads foo.bar
• Each s-exprssion in the file is read and
evaluated.
CommentsComments
• In Lisp, a comment begins with a semicolon (;)
and continues to the end of the line
• Conventions for ;;; and ;; and ;
• Function document strings:
(defun square (x)
“(square x) returns x*x”
(* x x))
Read – eval - printRead – eval - print
Lisp’s interpreter essentially does:
(loop (print (eval (read)))
i.e.,
1.Read an expression
2.Evaluate it
3.Print the resulting value
4.Goto 1
Understanding the rules for evaluating an expression is
key to understanding lisp.
Reading and printing, while a bit complicated, are
conceptually simple.
Evaluate the Expression
Read an Expression
Print the result
When an error happensWhen an error happens
Evaluate the Expression
Read an Expression
Print the result
Evaluate the Expression
Read an Expression
Print the result
On an error
Return from error
Eval(S)Eval(S)
• If S is an atom, then call
evalatom(A)
• If S is a list, then call evallist(S)
EvalAtom(S)EvalAtom(S)
• Numbers eval to themselves
• T evals to T
• NIL evals to NIL
• Atomic symbol are treated as
variables, so look up the current
value of symbol
EvalList(S)EvalList(S)
• Assume S is (S1 S2 …Sn)
–If S1 is an atom representing a special form (e.g.,
quote, defun) handle it as a special case
–If S1 is an atom naming a regular function
•Evaluate the arguments S2 S3 .. Sn
•Apply the function named by S1 to the resulting
values
–If S1 is a list … more on this later …
VariablesVariables
• Atoms, in the right
context, as assumed to
be variables.
• The traditional way to
assign a value to an
atom is with the SET
function (a special
form)
• More on this later
[9]> (set 'a 100)
100
[10]> a
100
[11]> (set 'a (+ a a))
200
[12]> a
200
[13]> b
*** - EVAL: variable B has no value
1. Break [14]> ^D
[15]> (set 'b a)
200
[16]> b
200
[17]> (set 'a 0)
0
[18]> a
0
[19]> b
200
[20]>
InputInput
• (read) reads and returns one s-expression from
the current open input stream.
[1]> (read)
foo
FOO
[2]> (read)
(a b
(1 2))
(A B (1 2))
[3]> (read)
3.1415
3.1415
[4]> (read)
-3.000
-3.0
OutputOutput
[1]> (print '(foo bar))
(FOO BAR)
(FOO BAR)
[2]> (setq *print-length* 3 )
3
[3]> (print '(1 2 3 4 5 6 7 8))
(1 2 3 ...)
(1 2 3 ...)
[4]> (format t "The sum of one and one is ~s.~%"
(+ 1 1))
The sum of one and one is 2.
NIL
LetLet
• (let <vars><s1><s2>…<sn>)
–<vars> = (<var1>…<varn>)
–<var1> = <name> or (<name>) or (<name> <value>)
• Creates environment with local variables v1..vn,
initializes them in parallel & evaluates the <si>.
• Example:
>(let (x (y)(z (+ 1 2))) (print (list x y z)))
(NIL NIL 3)
(NIL NIL 3)
Iteration - LoopIteration - Loop
• (loop <s1><s2>…<sn>) executes the <si>’s until
an explicit return is done.
(defun echo ()
(loop (if (null (print (read)))
(return t)))
(defun rep () (loop (print (eval (read)))))
Iteration - DOIteration - DO
(do ((x 1 (1+ x))
(y 100 (1- y)))
((> x y)(+ x y))
(princ “Doing “)
(princ (list x y))
(terpri))
Getting help: apropos and describeGetting help: apropos and describe
> (defun foo (x) "foo is my function" (plus x x ))
FOO
> (apropos 'foo)
:FOO constant
FOO function
:FOOTER constant
> (describe 'foo)
FOO is the symbol FOO, lies in #<PACKAGE COMMON-LISP-USER>, is accessible in 1
package COMMON-LISP-USER, names a function, has 2 properties
SYSTEM::DEFINITION, SYSTEM::DOCUMENTATION-STRINGS.
Documentation as a FUNCTION:
foo is my function
For more information, evaluate (SYMBOL-PLIST 'FOO).
#<PACKAGE COMMON-LISP-USER> is the package named COMMON-LISP-USER. It has 2
nicknames CL-USER, USER.
It imports the external symbols of 2 packages COMMON-LISP, EXT and exports
no symbols, but no package uses these exports.
#<CLOSURE FOO (X) (DECLARE (SYSTEM::IN-DEFUN FOO)) (BLOCK FOO (PLUS X X))>
is an interpreted function.
argument list: (X)
Lisp and scheme i

More Related Content

What's hot

Cours : les listes chainées Prof. KHALIFA MANSOURI
Cours : les listes chainées  Prof. KHALIFA MANSOURI Cours : les listes chainées  Prof. KHALIFA MANSOURI
Cours : les listes chainées Prof. KHALIFA MANSOURI
Mansouri Khalifa
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
Pranay Neema
 
ED Unidad 4: Estructuras de datos no lineales (árboles)
ED Unidad 4: Estructuras de datos no lineales (árboles)ED Unidad 4: Estructuras de datos no lineales (árboles)
ED Unidad 4: Estructuras de datos no lineales (árboles)
Franklin Parrales Bravo
 
Tail recursion
Tail recursionTail recursion
Tail recursion
Rumman Ansari
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
Muthiah Abbhirami
 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data Structures
Priyanka Rana
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structureSajid Marwat
 
Les listes simplement chaînées en langage C
Les listes simplement chaînées en langage CLes listes simplement chaînées en langage C
Les listes simplement chaînées en langage C
Mohamed Lahby
 
Specification and complexity - algorithm
Specification and complexity - algorithmSpecification and complexity - algorithm
Specification and complexity - algorithm
Bipul Roy Bpl
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
Simplilearn
 
CS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna UniversityCS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna University
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Ordenamientos externos
Ordenamientos externosOrdenamientos externos
Ordenamientos externos
Angel Vázquez Patiño
 
Cours uml
Cours umlCours uml
Cours uml
zimamouche1
 
Fascicule tp programmation c
Fascicule tp programmation cFascicule tp programmation c
Fascicule tp programmation c
Missaoui Abdelbaki
 
Recursividad
RecursividadRecursividad
Recursividad
TAtiizz Villalobos
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
Adam Mukharil Bachtiar
 
Regular Expressions To Finite Automata
Regular Expressions To Finite AutomataRegular Expressions To Finite Automata
Regular Expressions To Finite Automata
International Institute of Information Technology (I²IT)
 

What's hot (20)

Cours : les listes chainées Prof. KHALIFA MANSOURI
Cours : les listes chainées  Prof. KHALIFA MANSOURI Cours : les listes chainées  Prof. KHALIFA MANSOURI
Cours : les listes chainées Prof. KHALIFA MANSOURI
 
Sjf srtf
Sjf   srtfSjf   srtf
Sjf srtf
 
Sorting Algorithms
Sorting AlgorithmsSorting Algorithms
Sorting Algorithms
 
ED Unidad 4: Estructuras de datos no lineales (árboles)
ED Unidad 4: Estructuras de datos no lineales (árboles)ED Unidad 4: Estructuras de datos no lineales (árboles)
ED Unidad 4: Estructuras de datos no lineales (árboles)
 
Tail recursion
Tail recursionTail recursion
Tail recursion
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data Structures
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
Les listes simplement chaînées en langage C
Les listes simplement chaînées en langage CLes listes simplement chaînées en langage C
Les listes simplement chaînées en langage C
 
Specification and complexity - algorithm
Specification and complexity - algorithmSpecification and complexity - algorithm
Specification and complexity - algorithm
 
Lect07
Lect07Lect07
Lect07
 
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
What Is Dynamic Programming? | Dynamic Programming Explained | Programming Fo...
 
CS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna UniversityCS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna University
 
Ordenamientos externos
Ordenamientos externosOrdenamientos externos
Ordenamientos externos
 
Cours uml
Cours umlCours uml
Cours uml
 
Fascicule tp programmation c
Fascicule tp programmation cFascicule tp programmation c
Fascicule tp programmation c
 
Recursividad
RecursividadRecursividad
Recursividad
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
 
Heaps
HeapsHeaps
Heaps
 
Regular Expressions To Finite Automata
Regular Expressions To Finite AutomataRegular Expressions To Finite Automata
Regular Expressions To Finite Automata
 

Viewers also liked

ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
Z_ELEFTHERIA
 
Algoritmo Genético
Algoritmo GenéticoAlgoritmo Genético
Algoritmo Genético
Karen Mendoza
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Fraboni Ec
 
What have you learned from audience feedback?
What have you learned from audience feedback?What have you learned from audience feedback?
What have you learned from audience feedback?
Jazz Tallulah
 
Agentes de Búsqueda Online y Ambientes Desconocidos
Agentes de Búsqueda Online y Ambientes DesconocidosAgentes de Búsqueda Online y Ambientes Desconocidos
Agentes de Búsqueda Online y Ambientes Desconocidos
Karen Mendoza
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
Luis Goldster
 
μαθημα 1ο
μαθημα 1ομαθημα 1ο
μαθημα 1ο
liavassil
 
Lecture-3 Research Proposal
Lecture-3 Research ProposalLecture-3 Research Proposal
Lecture-3 Research ProposalShankor Paul
 
Ejercicios
EjerciciosEjercicios
Ejercicios
Karen Mendoza
 
Variable Rate Technology in Mallee by Alistair Murdoch
Variable Rate Technology in Mallee by Alistair MurdochVariable Rate Technology in Mallee by Alistair Murdoch
Variable Rate Technology in Mallee by Alistair Murdoch
Amanda Woods
 
Minimax
MinimaxMinimax
Minimax
Karen Mendoza
 
CONCEPTOS BÁSICOS DE LÍMITES
CONCEPTOS BÁSICOS DE LÍMITESCONCEPTOS BÁSICOS DE LÍMITES
CONCEPTOS BÁSICOS DE LÍMITES
innovalabcun
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
Tony Nguyen
 
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
DImitrios Drogidis
 
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
Plutarco Echegoyen
 
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
John Tzortzakis
 

Viewers also liked (20)

ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
ΑΣΚΗΣΗ ΚΑΙ ΥΓΕΙΑ
 
print
printprint
print
 
Algoritmo Genético
Algoritmo GenéticoAlgoritmo Genético
Algoritmo Genético
 
Inheritance
InheritanceInheritance
Inheritance
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Poo java
Poo javaPoo java
Poo java
 
What have you learned from audience feedback?
What have you learned from audience feedback?What have you learned from audience feedback?
What have you learned from audience feedback?
 
Agentes de Búsqueda Online y Ambientes Desconocidos
Agentes de Búsqueda Online y Ambientes DesconocidosAgentes de Búsqueda Online y Ambientes Desconocidos
Agentes de Búsqueda Online y Ambientes Desconocidos
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
μαθημα 1ο
μαθημα 1ομαθημα 1ο
μαθημα 1ο
 
Lecture-3 Research Proposal
Lecture-3 Research ProposalLecture-3 Research Proposal
Lecture-3 Research Proposal
 
Ejercicios
EjerciciosEjercicios
Ejercicios
 
Variable Rate Technology in Mallee by Alistair Murdoch
Variable Rate Technology in Mallee by Alistair MurdochVariable Rate Technology in Mallee by Alistair Murdoch
Variable Rate Technology in Mallee by Alistair Murdoch
 
Minimax
MinimaxMinimax
Minimax
 
CONCEPTOS BÁSICOS DE LÍMITES
CONCEPTOS BÁSICOS DE LÍMITESCONCEPTOS BÁSICOS DE LÍMITES
CONCEPTOS BÁSICOS DE LÍMITES
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Api crash
Api crashApi crash
Api crash
 
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
Διέλεξη του Δρ. Δ. Δρογίδη με θέμα «Θέατρο και Εκπαίδευση» στο Δημόσιο ΙΕΚ Αρ...
 
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
Plagas, enfermedades y cambio climático: Situación prevista y medidas de adap...
 
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
Παρουσίαση Τομέα Δομικών Έργων Δομημένου Περιβάλλοντος & Αρχιτεκτονικού Σχεδι...
 

Similar to Lisp and scheme i

Lisp
LispLisp
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.ppt
Luis Soza
 
intro.ppt
intro.pptintro.ppt
intro.ppt
Luis Soza
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
prakashvs7
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
DataminingTools Inc
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
LISP Content
 
Lisp
LispLisp
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
Yaser Jaradeh
 
LISP.ppt
LISP.pptLISP.ppt
LISP.ppt
HasnaatCH2
 
Programming_Language_Syntax.ppt
Programming_Language_Syntax.pptProgramming_Language_Syntax.ppt
Programming_Language_Syntax.ppt
Amrita Sharma
 
Introduction to lambda calculus
Introduction to lambda calculusIntroduction to lambda calculus
Introduction to lambda calculus
Afaq Siddiqui
 
Scheme language
Scheme languageScheme language
Scheme language
JITENDRA LENKA
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present Future
IndicThreads
 
Functional Programming - Past, Present and Future
Functional Programming - Past, Present and FutureFunctional Programming - Past, Present and Future
Functional Programming - Past, Present and Future
Pushkar Kulkarni
 
Syntax Analyzer.pdf
Syntax Analyzer.pdfSyntax Analyzer.pdf
Syntax Analyzer.pdf
kenilpatel65
 
parsing.pptx
parsing.pptxparsing.pptx
parsing.pptx
Aman564573
 
Regular expressions h1
Regular expressions h1Regular expressions h1
Regular expressions h1
Rajendran
 

Similar to Lisp and scheme i (20)

Lisp
LispLisp
Lisp
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
Lisp, An Introduction.ppt
Lisp, An Introduction.pptLisp, An Introduction.ppt
Lisp, An Introduction.ppt
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
AI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptxAI UNIT-4 Final (2).pptx
AI UNIT-4 Final (2).pptx
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
 
Lisp
LispLisp
Lisp
 
Lisp Programming Languge
Lisp Programming LangugeLisp Programming Languge
Lisp Programming Languge
 
LISP.ppt
LISP.pptLISP.ppt
LISP.ppt
 
Programming_Language_Syntax.ppt
Programming_Language_Syntax.pptProgramming_Language_Syntax.ppt
Programming_Language_Syntax.ppt
 
Introduction to lambda calculus
Introduction to lambda calculusIntroduction to lambda calculus
Introduction to lambda calculus
 
Lexicalanalyzer
LexicalanalyzerLexicalanalyzer
Lexicalanalyzer
 
Lexicalanalyzer
LexicalanalyzerLexicalanalyzer
Lexicalanalyzer
 
Scheme language
Scheme languageScheme language
Scheme language
 
Functional Programming Past Present Future
Functional Programming Past Present FutureFunctional Programming Past Present Future
Functional Programming Past Present Future
 
Functional Programming - Past, Present and Future
Functional Programming - Past, Present and FutureFunctional Programming - Past, Present and Future
Functional Programming - Past, Present and Future
 
Syntax Analyzer.pdf
Syntax Analyzer.pdfSyntax Analyzer.pdf
Syntax Analyzer.pdf
 
parsing.pptx
parsing.pptxparsing.pptx
parsing.pptx
 
Regular expressions h1
Regular expressions h1Regular expressions h1
Regular expressions h1
 

More from Luis Goldster

Ruby on rails evaluation
Ruby on rails evaluationRuby on rails evaluation
Ruby on rails evaluation
Luis Goldster
 
Design patterns
Design patternsDesign patterns
Design patterns
Luis Goldster
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
Luis Goldster
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Luis Goldster
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
Luis Goldster
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
Luis Goldster
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
Luis Goldster
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
Luis Goldster
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
Luis Goldster
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
Luis Goldster
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Luis Goldster
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
Luis Goldster
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Luis Goldster
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Luis Goldster
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your site
Luis Goldster
 

More from Luis Goldster (20)

Ruby on rails evaluation
Ruby on rails evaluationRuby on rails evaluation
Ruby on rails evaluation
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Ado.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworksAdo.net &amp; data persistence frameworks
Ado.net &amp; data persistence frameworks
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 
Business analytics and data mining
Business analytics and data miningBusiness analytics and data mining
Business analytics and data mining
 
Big picture of data mining
Big picture of data miningBig picture of data mining
Big picture of data mining
 
Data mining and knowledge discovery
Data mining and knowledge discoveryData mining and knowledge discovery
Data mining and knowledge discovery
 
Cache recap
Cache recapCache recap
Cache recap
 
Directory based cache coherence
Directory based cache coherenceDirectory based cache coherence
Directory based cache coherence
 
Hardware managed cache
Hardware managed cacheHardware managed cache
Hardware managed cache
 
How analysis services caching works
How analysis services caching worksHow analysis services caching works
How analysis services caching works
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Optimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessorsOptimizing shared caches in chip multiprocessors
Optimizing shared caches in chip multiprocessors
 
Api crash
Api crashApi crash
Api crash
 
Object model
Object modelObject model
Object model
 
Abstraction file
Abstraction fileAbstraction file
Abstraction file
 
Abstract class
Abstract classAbstract class
Abstract class
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Rest api to integrate with your site
Rest api to integrate with your siteRest api to integrate with your site
Rest api to integrate with your site
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 

Lisp and scheme i

  • 2. Versions of LISPVersions of LISP • LISP is an acronym for LISt Processing language • Lisp is an old language with many variants – Fortran is the only older language still in wide use – Lisp is alive and well today • Most modern versions are based on Common Lisp • Scheme is one of the major variants – We will use Scheme, not Lisp, in this class – Scheme is used for CS 101 in quite a few Universities • The essentials haven’t changed much
  • 3. LISP FeaturesLISP Features • S-expression as the universal data type – Atoms are similar to identifiers, but can also be numeric constants – Lists can be lists of atoms, lists, or any combination of the two • Functional Programming Style - computation is done by applying functions to arguments, functions are first class objects, minimal use of side-effects • Uniform Representation of Data & Code – e.g., (A B C D) is – A list of four elements (interpreted as data) – An application of the function ‘A’ to the three parameters B, C, and D (interpreted as code) • Reliance on Recursion – iteration is provided too, but recursion is considered more natural. • Garbage Collection – frees programmers explicit memory management.
  • 4. What’s Functional Programming?What’s Functional Programming? • FP: computation is applying functions to data • Imperative or procedural programming: a program is a set of steps to be done in order • FP eliminates or minimizes side effects and mutable objects that create/modify state –E.g., consider f1( f2(a), f2(b)) • FP treats functions as objects that can stored, passed as arguments, composed, etc.
  • 5. Pure Lisp and Common LispPure Lisp and Common Lisp • Lisp has a small and elegant conceptual core that has not changed much in almost 50 years. • McCarthy’s original Lisp paper defined all of Lisp using just seven primitive functions • Common Lisp was developed in the 1908s as an ANSI standard for Lisp • It is large (> 800 built-in functions), has all the modern data-types, good programming environments, and good compilers.
  • 6. SchemeScheme • Scheme is a dialect of Lisp that is favored by people who teach and study programming languages • Why? –It’s simpler and more elegant than Lisp –It’s pioneered many new programming language ideas (e.g., continuations, call/cc) –It’s influenced Lisp (e.g., lexical scoping of variables) –It’s still evolving, so it’s a good vehicle for new ideas
  • 7. But I wanted to learn Lisp!But I wanted to learn Lisp! • Lisp is used in many practical systems, but Scheme is not • Learning Scheme is a good introduction to Lisp • We can only give you a brief introduction to either language, and at the core, Scheme and Lisp are the same • We’ll point out some differences along the way
  • 8. DrScheme and MzSchemeDrScheme and MzScheme • We’ll use the PLT Scheme system developed by a group of academics (Brown, Northeastern, Chicago, Utah) • It’s most used for teaching introductory CS courses • MzScheme is the basic scheme engine and can be called from the command line and assumes a terminal style interface • DrScheme is a graphical programming environment for Scheme
  • 11. Informal SyntaxInformal Syntax • An atom is either an integer or an identifier. • A list is a left parenthesis, followed by zero or more S-expressions, followed by a right parenthesis. • An S-expression is an atom or a list. • Example: (A (B 3) (C) ( ( ) ) )
  • 12. Hello WorldHello World (define (helloWorld) ;; prints and returns the message. (printf “Hello Worldn”))
  • 13. REPLREPL • Lisp and Scheme are interactive and use what is known as the “read, eval, print loop” –While true • Read one expression from the open input • Evaluate the expression • Print it’s returned value • (define (repl) (print (eval (read))) (repl))
  • 14. What is evaluation?What is evaluation? • Scheme has a set of rules that say how to evaluate an s-expression • We will get to these very soon
  • 15. Built-in Scheme DatatypesBuilt-in Scheme Datatypes Basic Datatypes • Booleans • Numbers • Strings • Procedures • Symbols • Pairs and Lists The Rest • Bytes and Byte Strings • Keywords • Characters • Vectors • Hash Tables • Boxes • Void and Undefined
  • 16. Lisp: T and NILLisp: T and NIL • NIL is the name of the empty list, ( ) • As a test, NIL means “false” • T is usually used to mean “true,” but… • …anything that isn’t NIL is “true” • NIL is both an atom and a list –it’s defined this way, so just accept it
  • 17. Scheme: #t, #f, and ‘()Scheme: #t, #f, and ‘() • So, the boolean datatype in scheme includes #t and #f • Scheme represents empty lists as the literal ‘( ) • #t is a special symbol that represents true • #f represents false • But in practice, anything that is not equal to #f is true • Booleans evaluate to themselves
  • 18. NumbersNumbers • Scheme has integers (42) and floats (3.14) • But also rational numbers –(/ 1 3) => 1/3 • Complex numbers • and infinite precision integers • Numbers evaluate to themselves
  • 19. StringsStrings • Strings are fixed length arrays of characters –“foo” –“foo barn” –“foo ”bar”” • Strings evaluate to themselves
  • 20. PredicatesPredicates • A predicate (in any computer language) is a function that returns either “true” or “false” • In Lisp, –“false” is represented by #f –“true” is represented by anything that isn’t #t • Hence, a Lisp predicate returns either #f or something else –Predicates often return “true” values other than #t, especially if the returned value might be useful –E.g. (member ‘c ‘(a b c d e f)) returns ‘(d e f))
  • 21. Function calls and dataFunction calls and data • A function call is written as a list – the first element is the name of the function – remaining elements are the arguments • Example: (F A B) – calls function F with arguments A and B • Data is written as atoms or lists • Example: (F A B) is a list of three elements – Do you see a problem here?
  • 22. QuotingQuoting • Is (F A B) a call to F, or is it just data? • All literal data must be quoted (atoms, too) • (QUOTE (F A B)) is the list (F A B) – QUOTE is not a function, but a special form – The arguments to a special form are not evaluated or evaluated in some special manner • '(F A B) is another way to quote data – There is just one single quote at the beginning – It quotes one S-expression
  • 23. SymbolsSymbols • Symbols are atomic names > ’foo foo > (symbol? ‘foo) #t • Symbols are used as names of variables and procedures –(define foo 100) –(define (add2 x) (+ x 2))
  • 24. Basic FunctionsBasic Functions • CAR returns the head of a list (car ‘(1 2 3)) => 1 (first ‘(1 2 3)) => 1 ;; for people who don’t like car • CDR returns the tail of a list (cdr ‘(1 2 3)) => (2 3) (rest ‘(1 2 3)) => (2 3) ;; for people who don’t like cdr • CONS inserts a new head into a list (cons 1 ‘(2 3)) => (1 2 3)
  • 25. More Basic FunctionsMore Basic Functions • EQ? compares two atoms for equality (eq ‘foo ‘foo) => #t, (eq ‘foo ‘bar) => #f • ATOM tests if its argument is an atom (atom ‘foo) => #t, (atom ‘(1 2)) => #f
  • 26. Other useful FunctionsOther useful Functions • (NULL? S) tests if S is the empty list – (NULL? ‘(1 2 3) => #f – (NULL? ‘()) => #t • (LIST? S) tests if S is a list – (listp ‘(1 2 3)) =>#t – (listp ‘3) => #f
  • 27. More useful FunctionsMore useful Functions • LIST makes a list of its arguments – (LIST 'A '(B C) 'D) => (A (B C) D) – (LIST (CDR '(A B)) 'C) => ((B) C) • Note that the parenthesized prefix notation makes it easy to define functions that take a varying number or arguments. – (LIST ‘A) => (A) – (LIST) => ( )
  • 28. More useful FunctionsMore useful Functions APPEND concatenates two lists – (APPEND ‘(1 2) ‘(3 4)) => (1 2 3 4) – (APPEND '(A B) '((X) Y)) => (A B (X) Y) – (APPEND ‘( ) ‘(1 2 3)) => (1 2 3) – (APPEND NIL NIL NIL) => NIL
  • 29. Dotted PairsDotted Pairs • The second argument to CONS can be: – A list: the result is always another list – An atom: the result is a dotted pair • CONS of A and B is (A . B) – (CAR ‘(A . B)) => A – (CDR ‘(A . B)) => B
  • 30. EQUAL? and EQ?EQUAL? and EQ? • EQUAL? tests whether two s-expressions are “the same”. – (equal ‘(a b (c)) ‘(a b (c))) => #t – (equal ‘(a (b) c) ‘(a b (c))) => #f • EQ? tests whether two symbols are equal – (eq ‘foo ‘foo) => #t – (eq ‘foo ‘bar) => #f • EQ? is just a pointer test, like Java’s ‘=‘ • EQUAL? compares two complex objects, like a Java object’s equal method
  • 31. ATOMATOM • ATOM takes any S-expression as an argument • ATOM returns “true” if the argument you gave it is an atom • As with any predicate, ATOM returns either NIL or something that isn't NIL
  • 32. CONDCOND • COND implements the if...then...elseif...then...elseif...then... control structure • The arguments to a function are evaluated before the function is called – This isn't what you want for COND • COND is a special form, not a function
  • 33. Special formsSpecial forms • A function always evaluates all of its arguments • A special form is like a function, but it evaluates the arguments as it needs them • IF, COND, QUOTE and DEFINE are special forms • Scheme and Lisp lets you define your own special forms • We won't be defining special forms in this course
  • 34. Form of theForm of the CONDCOND (COND (condition1 result1 ) (condition2 result2 ) . . . (T resultN ) )
  • 35. Cond ExampleCond Example (cond ((not (number? x)) 0) ((< x 0) 0) ((< x 10) x) (#t 10)) (if (not (number? x)) 0 (if (<x 0) 0 (if (< x 10) x 10)))
  • 36. IFIF • In addition to COND, Lisp and Scheme have an IF special form that does much the same thing • Note: IF is a function that returns a value. • (IF <test> <then> <else>) – (IF (< 4 6) ‘foo ‘bar) => foo – (IF (< 4 2) ‘foo ‘bar) => bar • (IF <test> <then>) – (IF (= 1 (+ 2 1)) ‘foo) => #f
  • 37. Defining FunctionsDefining Functions (DEFINE (function_name . parameter_list) . function_body ) • Examples: ;; Test if the argument is the empty list (DEFUN NULL (X) (IF X NIL T)) ;; Square a number (defun square (n) (* n n)) ;; absolute difference between two numbers. (defun diff (x y) (if (> x y) (- x y) (- y x)))
  • 38. Example: MEMBERExample: MEMBER • As an example we define MEMBER, which tests whether an atom is in a list of atoms (DEFUN MEMBER (X LIST) ;; X is a top-level member of a list if it is the first ;; element or if it is a member of the rest of the list. (COND ((NULL LIST) NIL) ((EQUAL X (CAR LIST)) T) (T (MEMBER X (CDR LIST))) ) ) • MEMBER is typically a built-in function
  • 39. Example: MEMBERExample: MEMBER • Here’s how MEMBER is actually defined: (DEFUN MEMBER (X LIST) (COND ((NULL LIST) NIL) ((EQUAL X (CAR LIST)) LIST) (T (MEMBER X (CDR LIST))) ) ) • Note that it returns NIL (if the 1st arg not found) or the sublist starting with the 1st arg. Why?
  • 40. AppendAppend • (append ‘(1 2 3) ‘(a b)) => (1 2 3 a b) • Here are two versions, using if and cond: (defun append (l1 l2) (if (null l1) l2 (cons (car l1) (append (cdr l1) l2))))) (defun append (l1 l2) (cond ((null l1) l2) (t (cons (car l1) (append (cdr l1) l2)))))
  • 41. Example: SETSExample: SETS • Suppose we implement sets and set operationsSuppose we implement sets and set operations (union, intersection, difference)(union, intersection, difference) • We could treat a set as just a list and implementWe could treat a set as just a list and implement the operations so that they enforce uniquenessthe operations so that they enforce uniqueness of membership.of membership. • Here is set-addHere is set-add (defun set-add (thing set) ;; returns a set formed by adding THING to set SET (if (member thing set) set (cons thing set)))
  • 42. Example: SETSExample: SETS • Union is only slightly more complicatedUnion is only slightly more complicated (defun union (S1 S2) ;; returns the union of sets S1 and S2 (if (null S1) S2 (add-set (car S1) (union (cdr S1) S2)))
  • 43. Example: SETSExample: SETS • And intersection is also simpleAnd intersection is also simple (defun intersection (S1 S2) ;; returns the intersection of sets S1 and S2 (cond ((null s1) nil) ((member (car s1) s2) (intersection (cdr s1) s2)) (T (cons (car s1) (intersection (cdr s1) s2)))))
  • 44. ReverseReverse • Reverse is another common operation on Lists • It reverses the “top-level” elements of a list – Speaking more carefully, it constructs a new list equal to it’s argument with the top level elements in reverse order. • (reverse ‘(a b (c d) e)) => (e (c d) b a) (defun reverse (L) (if (null L) NIL (append (reverse (cdr L)) (list (car L))))
  • 45. Reverse is NaïveReverse is Naïve • The previous version is often called naïve reverse because it’s so inefficient? • What’s wrong with it? • It has two problems –The kind of recursion it does grows the stak when it does not need to –It ends up making lots of needless copies of parts of the list
  • 46. Tail Recursive ReverseTail Recursive Reverse • The way to fix the first problem is to employ tail recursion • The way to fix the second problem is to avoid append. • So, here is a better reverse: (defun reverse2 (L) (reverse-sub L NIL)) (defun reverse-sub (L answer) (if (null L) answer (reverse-sub (cdr L) (cons (car L) answer))))
  • 47. Still more useful functionsStill more useful functions • (LENGTH L) returns the length of list L – The “length” is the number of top-level elements in the list • (RANDOM N) , where N is an integer, returns a random integer >= 0 and < N • EQUAL tests if two S-expressions are equal – If you know both arguments are atoms, use EQ instead
  • 48. Programs on filePrograms on file • Use any text editor to create your program • Save your program on a file with the extension .lsp • (Load ‘foo) loads foo.lsp • (load “foo.bar”) loads foo.bar • Each s-exprssion in the file is read and evaluated.
  • 49. CommentsComments • In Lisp, a comment begins with a semicolon (;) and continues to the end of the line • Conventions for ;;; and ;; and ; • Function document strings: (defun square (x) “(square x) returns x*x” (* x x))
  • 50. Read – eval - printRead – eval - print Lisp’s interpreter essentially does: (loop (print (eval (read))) i.e., 1.Read an expression 2.Evaluate it 3.Print the resulting value 4.Goto 1 Understanding the rules for evaluating an expression is key to understanding lisp. Reading and printing, while a bit complicated, are conceptually simple. Evaluate the Expression Read an Expression Print the result
  • 51. When an error happensWhen an error happens Evaluate the Expression Read an Expression Print the result Evaluate the Expression Read an Expression Print the result On an error Return from error
  • 52. Eval(S)Eval(S) • If S is an atom, then call evalatom(A) • If S is a list, then call evallist(S)
  • 53. EvalAtom(S)EvalAtom(S) • Numbers eval to themselves • T evals to T • NIL evals to NIL • Atomic symbol are treated as variables, so look up the current value of symbol
  • 54. EvalList(S)EvalList(S) • Assume S is (S1 S2 …Sn) –If S1 is an atom representing a special form (e.g., quote, defun) handle it as a special case –If S1 is an atom naming a regular function •Evaluate the arguments S2 S3 .. Sn •Apply the function named by S1 to the resulting values –If S1 is a list … more on this later …
  • 55. VariablesVariables • Atoms, in the right context, as assumed to be variables. • The traditional way to assign a value to an atom is with the SET function (a special form) • More on this later [9]> (set 'a 100) 100 [10]> a 100 [11]> (set 'a (+ a a)) 200 [12]> a 200 [13]> b *** - EVAL: variable B has no value 1. Break [14]> ^D [15]> (set 'b a) 200 [16]> b 200 [17]> (set 'a 0) 0 [18]> a 0 [19]> b 200 [20]>
  • 56. InputInput • (read) reads and returns one s-expression from the current open input stream. [1]> (read) foo FOO [2]> (read) (a b (1 2)) (A B (1 2)) [3]> (read) 3.1415 3.1415 [4]> (read) -3.000 -3.0
  • 57. OutputOutput [1]> (print '(foo bar)) (FOO BAR) (FOO BAR) [2]> (setq *print-length* 3 ) 3 [3]> (print '(1 2 3 4 5 6 7 8)) (1 2 3 ...) (1 2 3 ...) [4]> (format t "The sum of one and one is ~s.~%" (+ 1 1)) The sum of one and one is 2. NIL
  • 58. LetLet • (let <vars><s1><s2>…<sn>) –<vars> = (<var1>…<varn>) –<var1> = <name> or (<name>) or (<name> <value>) • Creates environment with local variables v1..vn, initializes them in parallel & evaluates the <si>. • Example: >(let (x (y)(z (+ 1 2))) (print (list x y z))) (NIL NIL 3) (NIL NIL 3)
  • 59. Iteration - LoopIteration - Loop • (loop <s1><s2>…<sn>) executes the <si>’s until an explicit return is done. (defun echo () (loop (if (null (print (read))) (return t))) (defun rep () (loop (print (eval (read)))))
  • 60. Iteration - DOIteration - DO (do ((x 1 (1+ x)) (y 100 (1- y))) ((> x y)(+ x y)) (princ “Doing “) (princ (list x y)) (terpri))
  • 61. Getting help: apropos and describeGetting help: apropos and describe > (defun foo (x) "foo is my function" (plus x x )) FOO > (apropos 'foo) :FOO constant FOO function :FOOTER constant > (describe 'foo) FOO is the symbol FOO, lies in #<PACKAGE COMMON-LISP-USER>, is accessible in 1 package COMMON-LISP-USER, names a function, has 2 properties SYSTEM::DEFINITION, SYSTEM::DOCUMENTATION-STRINGS. Documentation as a FUNCTION: foo is my function For more information, evaluate (SYMBOL-PLIST 'FOO). #<PACKAGE COMMON-LISP-USER> is the package named COMMON-LISP-USER. It has 2 nicknames CL-USER, USER. It imports the external symbols of 2 packages COMMON-LISP, EXT and exports no symbols, but no package uses these exports. #<CLOSURE FOO (X) (DECLARE (SYSTEM::IN-DEFUN FOO)) (BLOCK FOO (PLUS X X))> is an interpreted function. argument list: (X)