more match() problems
- Posted by Al Getz <Xaxo at aol.com> May 28, 2003
- 462 views
Hello again, Looking closer at the match() function, i find that it doesnt really work very well unless you are only using it on one level sequences (like {1,2,3} or "abc"). Untill this point, i dont think i ever used it for anything else, but since we were looking at it anyway i thought i would mention this. match({2,3},{1,2,3}) returns the number 2, because the 'slice' was found in the second sequence. Works fine. Now, match({{1,2,3}},{{1,2,3}}) returns the number 1, because again the 'slice' (although this time deeper) was found in the second sequence. Works fine. Nowwwwwwwww... what does match({{2,3}},{{1,2,3}}) return? (same example with the 1 missing in first arg) If you said the number 2, you are correct, because the 'slice' could be found in the second sequence at the required level, right??? Well, guess again! The Eu match command returns a big fat zero! Yes, that's right, i=match({{1,2,3}},{{1,2,3}}) -- rets 1 but i=match({{2,3}},{{1,2,3}}) -- rets 0 Care to try to figure that out? I guess i went too far in assuming there was a method to the madness. Anomaly number 97316 and counting... Take care, Al