RE: match() (not short, he he)
- Posted by gertie at visionsix.com May 26, 2003
- 397 views
On 26 May 2003, at 18:49, Al Getz wrote: > > > gertie at visionsix.com wrote: > > > > > > On 26 May 2003, at 16:00, Al Getz wrote: > > > > A nice post. But i just thought of something. All the previous posts i > > read on > > this (mine included) worked with *strings*, not nested sequences. What > > about: match("",{"k","","at"}) ? > > > > Kat > > > > Hello again, > > I think you meant > > match({""},{"k","","at"}) > > right? > > I meant to mention that i noticed that match works for > match({""},{"k","a","t"}) Because as you point out later, {""} isn't an empty or null {}. > length({""}) > returns 1, which says something is there also, while > length("") > returns 0, which says nothing is there at all. I use length() a lot, just for this sort of fault tolerance in "" strings/sequences. > Any other interesting ideas like that? > I hope you have some more, i'd like to hear them too Yes, strangely enough, i have other ideas. i'd prefer match('a',"something") to not fail because of the alledgedly abhorent reason that 'a' isn't a sequence. It's too late to change, but i'd prefer match('a',"kat") to return 2, since the 'a' in "kat" is an atom. And match("b",{"a",'b',"b","c"}) to return 3, because the third element "b" in the second parameter of match is a sequence, and the 2nd parameter isn't. I haveto test parms in match() for that first parm being a sequence all the time too. Kat