Home | Notes | Languages | Programs | Homework |
Re: HW#3 question 2 |
Stephen Edwards (edwards@CS.VT.EDU)
Mon, 17 Sep 2001 09:28:50 -0400
Message-ID: <3BA5FA92.BD20EC14@cs.vt.edu> Date: Mon, 17 Sep 2001 09:28:50 -0400 From: Stephen Edwards <edwards@CS.VT.EDU> Subject: Re: HW#3 question 2
> Jonathan Berkowitz wrote:
>
> I don't understand what question 2 means by two lists having the same
> list structure and also possibly having different atoms. If someone
> could give an example of two lists that are structurally equal that
> would be help.
Consider these four lists:
A is (a b c (d (e f)) (g))
B is (h i j (k (l m)) (n))
C is (a b c d e f g)
D is (a b c (d e f) (g))
Here, A and B have the same "list structure", even though the atoms they
contain are different. A and C have the same atoms, but different
list structure. A is a list of 5 elements: three atoms followed by two
lists. C is a list of 7 atoms that has no sublists within it.
Note that A and D also have different structure. Even though they both
have the same number of elements, the 4th item in A is (d (e f)) and the
4th item in D is (d e f), and these two elements clearly have different
list structure.
-- Steve
-- Stephen Edwards 604 McBryde Hall Dept. of Computer Science e-mail : edwards@cs.vt.edu U.S. mail: Virginia Tech (VPI&SU) office phone: (540)-231-5723 Blacksburg, VA 24061-0106 -------------------------------------------------------------------------------
Home | Notes | Languages | Programs | Homework |