4. Syntax in Functions
Patterns, guards, where, let, and case.
Sections
Questions to help you understand Chapter 4.
Slideshow of Discussion problems for Chapter 4. Similar but not identical to reading guide questions.
Discussion on first half of the reading guide for Chapter 4.
Lots of problems so you can practice writing Haskell.
A few practice problems from a Thursday review session.
In the game of Scrabble you try to fit a word into spaces with some letters already in place. In this question you will write a function to determine if a word fits into a certain space. wordFits :: String -> String -> Bool wordFits "jerk "_or_" == False wordFits "work" "__r_" == True Along the way you may want to use a helper function to determine if characters from the same place match.
The alternating series is [1, -1/2, +1/3, -1/4, +1/5, -1/6, ...] Define altTerm n to be the nth term in the sequence. Define altSeq m to be the first first m terms in the sequence. Write a function to find the first k terms of the alternating series. Write waltSum, which takes in a list of numbers, multiplies each term by the corresponding term in the alternating series, and then adds up the sums.
Exercises to improve your Haskell programming.
Ten minute quiz.
patterns, guards, where, let, case
Simple testing in Haskell. Usable on repl.it.