Re: more match() problems
- Posted by gertie at visionsix.com May 29, 2003
- 475 views
On 28 May 2003, at 20:11, jbrown1050 at hotpop.com wrote: > > > On Wed, May 28, 2003 at 02:47:51PM -0500, gertie at visionsix.com wrote: > <snip> > > I always do something like this: > > > > if atom(x) > > then z = match({x},y) > > else z = match(x,y) > > end if > > > > or > > > > if sequence(x) > > then z = match(x,y) > > else exit -- cannot use a goto eoroutine here! > > end if > > > > If i don't, sure as heck x will be "" eventually and the app will crash. > > Testing for equal(x,"") or (length(x) = 0 ) repeatedly, over and over, ad > > nauseum helps(?) too. > > > > Why not: > > function mx(object x, sequence s) > return match(x, s) > end function > global function match(object x, sequence s) > if atom(x) then > x = {x} > end if > if length(x) = 0 then > return 0 > end if > return mx(x, s) > end function > > That would get you almost exactly what you want, at the price of including one > more file into your program(s). No need to type repeatedly like that anymore > ;] Nice, but there is overhead in function calls, and you make two of them. Kat