600. 429 FUNCTIONAL PROGRAMING AT WORK HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University
Todays Class • General Haskell ideas • Homework walkthrough • Haskell programming
Running Haskell Everyone doing OK? Note that the Win. Ghci is for windows only The command line is also good – I’ll use that today
Questions • What does it mean for a language to be lazy (non-strict)? • What is the advantage of purity? • How does Java differ from Haskell in the syntax of function definition / call? • What is the difference between assignment and definition?
Basic Types • How are Haskell types different from Java classes? • What is a single-constructor type? • What is a type with no arguments to any constructor? • What is a String is Haskell? • What is an arithmetic sequence? • Why does Haskell have unbounded sequences?
Types • • • What is a “polymorphic type”? What are the built-in types in Haskell? How does type inference work? How do Haskell types differ from Java classes? Interpret the following types: (a -> b) -> [a] -> [b] (a, b) -> a [a] -> [b] -> [(a, b)]
Touring the Prelude • Hoogle is your friend! Use it! • Mapping – what does this do? How does this look in Java? Why do you use this? • Zip – what does this do? Is there a Java equivalent? Why do you use this? • zip. With – what does this do? Java? Why? • Fold: Reduction
Fold and Scan • Fold: Reduction • Scan: State machine