RE: match() (not short, he he)
- Posted by Al Getz <Xaxo at aol.com> May 28, 2003
- 403 views
Hello again, I see now why there is so much confusion here. We are attempting to understand something basic, yet confusing the issue by the using something that belongs to another issue in general that, in itself, is also a little hard to understand. Once we remove this secondary issue from all the examples, the underlying concepts shine through bright and clear. The secondary issue i was talking about is that of using quotes around characters like "b", "abc" etc. This in itself clouds the issue, and so if we remove the use of quotes for all of the remaining discussions, the concepts will show through much better. Once we have determined for sure how things work without using ANY quotes, then we can come back and again look at cases with quotes, but im sure it will be much simpler then. Ok, so leaving the quotes out we have to use the ascii codes to represent the characters, such as 97,98,99, etc., but we dont even have to use characters for now really. With this in mind, let's repeat a couple of the examples: [1] match(2, {1,2,3}) --ret 0 [2] match({2}, {1,2,3}) --ret 2 [3] match({2}, {{1,2,3}}) --ret 0 Note that the level of the first arg determines where the second arg is searched, but unfortunately, it only works at level 1 unless you are looking for an exact match, which will be the subject for my next post about the problems with match. Take care, Al