Find Value No Match Property
if not (el = val), then index of value val in [ el, remain ] with current index idx = index of value val in remain with current index (idx + 1)
If the first element in the list is not equal to the value we are looking for, then pop the list and increment the index by 1. This allows us to move on to the next element.
Examples
if not (5 = 8), then index of value 8 in [ 5, [ 7, [ 8, [ ] ] ] ] with current index 0 = index of value 8 in [ 7, [ 8, [ ] ] ] with current index (0 + 1)
if not (2 = 3), then index of value 3 in [ 2, [ 3, [ 4, [ ] ] ] ] with current index 1 = index of value 3 in [ 3, [ 4, [ ] ] ] with current index (1 + 1)
if not ("Cherry" = "Durian"), then index of value "Durian" in [ "Cherry", [ "Durian", [ ] ] ] with current index 2 = index of value "Durian" in [ "Durian", [ ] ] with current index (2 + 1)
If we are looking for 13, and the list is currently
[11, [13, [15, []]]]
And the index is currently 3, then in the next step, the current index will change to:
If we are looking for 13, and the list is currently
[11, [13, [15, []]]]
And the index is currently 3, then in the next step, the list will change to
Comments
Please log in to add comments