l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2005 Jul 12 09:18

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Matching Contents of Lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Matching Contents of Lists

On Fri, Jul 08, 2005 at 03:53:00PM -0500, Jay Strauss wrote:
> Micah J. Cowan wrote:
> > On Fri, Jul 08, 2005 at 10:28:00AM -0500, Jay Strauss wrote:
> > 
> >>Micah J. Cowan wrote:
> > 
> > 
> > <snip>
> > 
> >>>First, you will need to create a comparison function, that will return
> >>>an integer less than, greater than, or equal to zero depending on
> >>>whether its first argument compares lexically less than, greater than,
> >>>or equal to its second argument. This function should match based on
> >>>your rules given above, and is meant as an analog for the cmp and <=>
> >>>operators.
> > 
> > 
> > <snip>
> > 
> >>Won't this just match identical records, and not account for his 
> >>matching rules?  Seems like this is just a programmatic SQL join
> > 
> > 
> > (Read the above paragraph).
> > 
> I didn't really know what you meant by "lexically".  I thought you might 
> be saying:
> return -1 if $a lt $b;
> return 0 if $a eq $b;
> return 1 if $a gt $b;

Well, and that's more or less what "lexically" would mean, if I hadn't
qualified it with "[matching] based on your rules above."

But there wouldn't be much point to rolling your own function otherwise,
when cmp works just fine ;-)

> But I now understand, you want to build sophisticated comparison, maybe 
> even character by character, to determine -1,0,1.  Seems hard, but 
> you've probably already boiled it down to a one-liner :)

No need for character by character comparison: in fact your regex-based
parsing would be fine. Just build the parsed string for each one, and
then do a cmp on that.

Micah J. Cowan
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!