Quiz 7 - Prolog List Length

CS 152 - Spring 2008

Name:

Student ID:

E-mail:

Determining if Two Prolog List Have Same Length

Please write a Prolog predicate same_len/2 that succeeds when both arguments are proper lists and the same length. Here are some example queries that should succeed with your program.

same_len([], []).
same_len([2], [1]).
same_len([[4|5], foo(one, two, three, four), 0], [1, 2, 3]).