Was looking for a good function to use to find elements and stumbled across SEARCH in the HyperSpec.
search sequence-1 sequence-2 &key from-end test test-not key start1 start2 end1 end2
I understand how search arrives at these results:
(search "dog" "it's a dog's life") => 7
(search '(0 1) (list 0 2 0 3 0 4 0 1 0 5)) => 6
But for some reason I cannot figure this one out, when :key is used:
(search '(0 1) '(2 4 6 1 3 5) :key #'oddp) => 2
I know :key is given a function, which in this case is asking if the element is odd, and I know that search returns the position in the second sequence in which the subsequence of the first sequence was found. How is the answer 2? To me it looks like this subsequnce is not in the second sequence at all, and definitely not in position 2 (where 6 is currently sitting).
Would love to have a good explanation of how this is working, thanks!