Table of ContentsThe HaskellProgramming Language An imperative language Scheme is still imperative A more realistic example Factoring out an expression Haskell:Works with fewer ifs and buts Overview of Haskell Haskell’s History The brevity of Haskell Quicksort in two lines! Haskell syntax Syntax:Haskell vs. Scheme Hugs98Haskell Users Gofer System One gotcha of Hugs98 Learning Haskell Some simple expressions When things do notgo according to plan... More errors... A simple example Fibonnaci numbersMathematical notation Fibonnaci numbers in HaskellTwo different approaches Indentation matters! Implicit vs. explicit grouping Explicit groupingis useful at the repl Function application Functions withmultiple arguments Currying Partial application Specializations Lambda expression syntax Functions vs. operators Other operators Why use tuples for arguments? Ackermann function(Wilhelm Ackermann, 1928) Patterns Wildcards in patterns Patterns and case expressions Conditionals List shorthands List comprehension Compare to usinghigher order functions Comprehension insteadof nested loops Values have types Functions have types too Built in types Dynamic vs. Static typing Advantages of static typing Static typing rules Application rule Cancellation rule Function rule List rule Tuple rule Length of list of integers Applying len to [Char] What does len rely on? Type variables Polymorphic functions Type inference Type unification Unification is the intersection of the described types Evaluation in Haskell Not all arguments getevaluated Eager evaluation vs.lazy evaluation Lazy evaluationis efficient No need for special forms Outside-in evaluation avoids intermediate lists |
Author: Greg J. Badros
Email: badros@cs.washington.edu Home Page: http://www.cs.washington.edu/education/courses/341/CurrentQtr |