CSE 341 Midterm 2 Review Session Monday, May 12, 2003
Lisp topics:
Closures and closure generators.
Free and bound variables
Unnamed functions
Explicit application of functions and closures
Separate sets of bindings vs shared bindings
Similarities and differences between closures and O-O objects
Evaluation rules in general.
Constants
Symbols and environments
Lexical vs dynamic bindings
Functional forms
Special forms
Macros
EVAL
Caveat on scoping with EVAL
Functional programming topics:
Composition and currying both in Lisp and ML.
Math definition of composition
Math def. Of currying
Composition in Lisp: a function for comp.
What if the domain and ranges are more complicated?
Currying in Lisp.
Fixing the kth argument rather than the 1st.
Composition in ML using o
Curried representation of multi-argument functions in ML.
Lazy evaluation.
No evaluation until value is required as part of an output value at top level.
Lisp functional forms: eager evaluation
Lisp AND, OR, IF, COND --- lazy.
Lazy evaluation in some languages permits working with “infinite data structures”.
ML topics:
Bindings (and how the environment model works)
val establishes new bindings that may hide earlier bindings of the same symbol.
Mutation is discouraged in the pure functional programming approach.
Yet mutation is available in order to implement efficient looping.
Types, including basic types, cartesian products, function
types, tuples, lists, and user-defined types.
ML's type inference system.
Constraint propagation
Underconstrained types, fully constrained types, overconstrained types
Explicit constraints: (x : int)
Implicit constraints: x + 5
ML's polymorphic types, such as 'a and ''a.
ML's handling of overloaded operators such as +, etc.
Also, know the mathematical definitions of sets, binary relations,
functions, and cartesian products. Also, the non-associativity
of the cartesian product.