tweak
[lambda.git] / exercises / assignment3_hint3.mdwn
1 ## Lists and List Comprehensions
2
3 8. Suppose you have two lists of integers, `left` and `right`. You want to determine whether those lists are equal, that is, whether they have all the same members in the same order. How would you implement such a list comparison?
4
5 *Here are some hints.*
6
7 *   If `left` is `[]`, what does `right` have to be for `left` and `right` to be equal? (Come on, it's not too hard.)
8
9 *   Suppose on the other hand that `left` has head `x` and tail `xs`.
10
11     1.  If `right` is then `[]`, are `left` and `right` equal?
12     2.  If `right` isn't `[]`, and its head isn't equal to `x`, are `left` and `right` equal?
13     3.  If `right` isn't `[]`, and its head *is* equal to `x`, what else has to be the case for `left` and `right` to be equal?
14
15 *   Can you now write a recursive definition of the `list_equal` function? What's your base case?