Hints for list_equal
.
If
left
is[]
, what doesright
have to be forleft
andright
to be equal? (Come on, it's not too hard, you can figure it out.)Suppose on the other hand that
left
has headleft_hd
and tailleft_tl
.- If
right
is then[]
, areleft
andright
equal? - If
right
isn't[]
, and its head isn't equal toleft_hd
, areleft
andright
equal? - If
right
isn't[]
and its head is equal toleft_hd
, what else has to be the case forleft
andright
to be equal?
- If
Can you now write a recursive definition of the
list_equal
function? What's your base case?