create page
authorjim <jim@web>
Sat, 14 Feb 2015 12:55:34 +0000 (07:55 -0500)
committerLinux User <ikiwiki@localhost.members.linode.com>
Sat, 14 Feb 2015 12:55:34 +0000 (07:55 -0500)
exercises/assignment3_hint3.mdwn [new file with mode: 0644]

diff --git a/exercises/assignment3_hint3.mdwn b/exercises/assignment3_hint3.mdwn
new file mode 100644 (file)
index 0000000..a58e0bd
--- /dev/null
@@ -0,0 +1,15 @@
+## Lists and List Comprehensions
+
+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?
+
+*Here are some hints.*
+
+*   If `left` is `[]`, what does `right` have to be for `left` and `right` to be equal? (Come on, it's not too hard.)
+
+*   Suppose on the other hand that `left` has head `x` and tail `xs`.
+
+    1.  If `right` is then `[]`, are `left` and `right` equal?
+    2.  If `right` isn't `[]`, and its head isn't equal to `x`, are `left` and `right` equal?
+    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?
+
+*   Can you now write a recursive definition of the `list_equal` function? What's your base case?