Re: more match() problems

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 ;]

> Kat
> 
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 

-- 
 /"\  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     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu