1. Re: match() (not short, he he)

On Mon, May 26, 2003 at 01:44:08PM -0500, gertie at visionsix.com wrote:
> 
> 
> On 26 May 2003, at 14:06, jbrown1050 at hotpop.com wrote:
> 
> > 
> > On Mon, May 26, 2003 at 12:40:31PM -0500, 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
> > > 
> > 
> > Even tho "" is in {"k","","at"} at index 2, I don't think match() should
> > return 2 in that case. (That would be the job of find("",{"k","","at"}),
> > imo.)
> 
> Why?
> 
<snip>

Well, alright, what would match("at", {"k","","at"}) return?
what would match({"at"}, {"k","","at"}) return?
what would match('a', "kat") return?

To avoid retyping, i'll add these constants:

constant x = {"k","","at"}, y = ""

y is an element of x, but it is not a subsequence of it. I think, that using
match() to find elements (even if the element itself is a sequence) is a bad
idea
(but not so bad that it should be a run-time error).

I think, we should be universal ... if match(y, x) returns 2, then match('a',
"kat")
should also return 2.

Or am I just being an idiot?

jbrown

-- 
 /"\  ASCII ribbon              | http://www.geocities.com/jbrown1050/
 \ /  campain against           | Linux User:190064
  X   HTML in e-mail and        | Linux Machine:84163
 /*\  news, and unneeded MIME   |

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu