scheme - Why do nested applications of cons construct improper lists? -
Do the nested apps of disasters create inappropriate lists? I am learning the plan and confused about it I know that when I understand the following pair: although I understand Can not find why the following expression creates inappropriate lists I just can not express what is happening with the expression above Can you please expand on that? The illusion you are experiencing It's not unique. Just signaling is all this, and until you learn that notation, everything is confusing. First of all, let's begin with the proper lists. There are lists which are empty Chi would end with: This list is a short story for Now, if we replace Note that this is no different from Of course, both of these are short stories for very long form cons I have come to this answer:
opposition < The second argument of / code> is a list, then it adds the first logic to the top of the list
(Opposition 1 (list2 3) => (1 2 3)
(cons 2 3); 2.3 pair
(1 1 2 .3); An inappropriate list
(cons 1 (cons 2 (cons 3 '()))); = & Gt; (1 2 3)
(1 2 3) , indeed
(1 2 3) < / Code>: Originally a list where the last cons indicates for an empty list.
() with 4, then see what we get:
(Opposition 1 (Opposition 2 (Opposition 3-4)); = & Gt; (1 2 3 .4)
(1 2 3. ()) , what is it?
(1 (2. (3 () ())) and
(1 (2. (3 .4))) , respectively.
Comments
Post a Comment