TOPICS FOR THE 541 TEST on Haskell and Functional Programming $Date: 2002/12/14 01:20:11 $ The test will be open book, open notes. (Warning: don't expect to learn the material during the test, you won't have time! A good idea might be to try to condense your notes to a few pages of ready reference materials.) Readings: Read Thompson's book, "Haskell: The Craft of Functional Programming (second edition)", chapters 1-7, 9-14 and 16-17. You may also want to read a tutorial on the concepts of functional programming languages, such as Hudak's computing survey article mentioned in the ``Introduction to the Literature'' handout, or the ``Gentle Introduction to Haskell'' for a different introduction to the language. In the following, I use + to denote relatively more important topics, and - to denote relatively less important topics. All of these are fair game, but if you have limited time, concentrate on the ones that are more important first (and in those, the ones you are most uncertain about). The names listed [in brackets] are the names of problems from the Haskell homework. We also give the names of extra credit problems that are relate. Note that many of the homework problems were drawn from earlier tests. SKILLS + Haskell programming; be able to: + give the output of a Haskell expression, possibly involving higher-order functions, or library functions of general utility, such as map, foldr, filter, or list comprehensions + use library functions such as map, foldr, and filter [delete_all, delete_second, matches, approximations, commaSeparate, onSeparateLines] and extra credit problems: isFunction, define ++ using foldr, doubleAll, map using foldr + use list comprehensions to define functions [delete_all, delete_second, matches, library database, doubleAll] and extra credit problems: brelCompose ++ write recursive functions on lists, numbers, and algebraic data types (grammars) (for grammars, expect to see something like a small interpreter or type checker) [delete_all, delete_second, merge, onSeparateLines, sumTree, preorderTree, typeOf for Exps] + write functions using tail recursion + use of infinite (lazy) lists to help modularize code [approximations, within, squareRoot, relativeSquareRoot, diffApproxims, differentiate] + use functions as data [compose, infinite sets, infinite geometric regions] and extra credit problem: compose - infer the types of expressions or functions - describe properties of a value in Haskell depending on its type [whether functions are constant from types] - generalize functions [separatedBy] and extra credit problem: foldTree - define instances of type classes [functor instance for Trees] - desugar expressions in Haskell - write monadic-style code - explain how a purely functional language like Haskell connects to the real world and still preserves referential transparency (using the IO type) TERMS AND CONCEPTS Although the terms and concepts parts will focus on functional programming, and to some domain specific languages, I am fond of asking "integrative" and comparative questions. For example, I might ask you to compare the notions of classes and method call found Smalltalk and Java vs. type classes and overloading in Haskell. Also, I might ask you to compare the reuse offered by Haskell to that offered by object-oriented or aspect-oriented languages. You should be able to explain and use (in problems or essays) the following (with appropriate comparisons to related concepts): + Haskell-related: + referential transparency + parametric vs. ad hoc polymorphism + polymorphic vs. monomorphic functions or types + lazy (or infinite) lists - type classes in Haskell (vs. C++ or Java's classes) - how abstract data types are supported in Haskell (vs. C++ or Java) - type inference (vs. type checking) - monads - assignment (as in C++ or Java) vs. binding (in Haskell) - free variables, bound variables, and capture - currying, partial parameterization (and what they're useful for) - syntactic sugars for: let, where, pattern matching, etc. and what's left after desugaring