Appending to a List Property

result of appending y to xs = reverse of [ y, reverse of xs ]

This property states that appending an element to a list is the same as reversing the list, prepending the element to it, and then reversing it again.

Examples

result of appending 7 to [ ] = reverse of [ 7, reverse of [ ] ]

result of appending 3 to [ 37, [ ] ] = reverse of [ 3, reverse of [ 37, [ ] ] ]

result of appending 5 to [ 17, [ 19, [ 21, [ ] ] ] ] = reverse of [ 5, reverse of [ 17, [ 19, [ 21, [ ] ] ] ] ]

result of appending 8 to [ 6, [ 4, [ 2, [ ] ] ] ] = reverse of [ 8, reverse of [ 6, [ 4, [ 2, [ ] ] ] ] ]

Quiz (1 point)

What is the reverse of [3, [2, [1, []]]]?

Become a subscriber to save your progress, see the correct answer, and more!
Quiz (1 point)

When we prepend 4 to [1, [2, [3, []]]], the result is:

Become a subscriber to save your progress, see the correct answer, and more!
Quiz (1 point)

What is the reverse of [4, [1, [2, [3, []]]]]?

Become a subscriber to save your progress, see the correct answer, and more!

Comments

Please log in to add comments