
















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















































































length( [1, 2]) should yield 2.
Trace: (length [1 , 2]) --top level call
list = (1 2) (length [2]) --recursive call 1 list = (2) (length []) -- recursive call 2 list = ( ) returns 0 --return for call 2 returns (+ 1 0) =1 --return for call 1 returns (+ 1 1) = 2 --return for top level call
len is a shallow recursive function
atomcount is a deep recursive function
def head(list): return list[0]
Lecture 4, Functional Programming, CS314 © BGRyder/MGCore
Lecture 4, Functional Programming, CS314 © BGRyder/MGCore
Functional Programming, CS314 © BGRyder, MGCore
Lecture 4, Functional Programming, CS314 © BGRyder/MGCore
Functional Programming, CS314 © BGRyder, MGCore
Lisp 1950’s John McCarthy
Scheme 1975 Guy Steele Gerald Sussman
Common Lisp
dynamic scoping lexical scoping functions as first class values
standardized PL