List Length Property

length of stack xs = length of remaining stack xs with count 0

This property says that the length of a list is equal to the length of a "remaining" list with count is 0. The "remaining" list is initially the same as the original list, but it becomes shorter as we count the elements. This conversion allows us to keep an element count.

Examples

length of stack [ 2, [ 4, [ 8, [ ] ] ] ] = length of remaining stack [ 2, [ 4, [ 8, [ ] ] ] ] with count 0

length of stack [ "Apple", [ "Orange", [ "Tomato", [ ] ] ] ] = length of remaining stack [ "Apple", [ "Orange", [ "Tomato", [ ] ] ] ] with count 0

length of stack [ True, [ False, [ ] ] ] = length of remaining stack [ True, [ False, [ ] ] ] with count 0


Comments

Please log in to add comments