Re: Decision Tables
- From: "Bartc" <bc@xxxxxxxxxx>
- Date: Wed, 30 Jan 2008 01:26:44 GMT
"Ben Bacarisse" <ben.usenet@xxxxxxxxx> wrote in message
news:87abmo9n9b.fsf@xxxxxxxxxxxx
"Bartc" <bc@xxxxxxxxxx> writes:
The business part is the half-dozen lines of Match(), which I'd imagine
would not be impossible in C, depending on the actual types of the fields
being tested.
It would not be that hard in C (though a little messy) but see below.
Function Match(A, B, map)=
forall i in map do
if A.[i]<>B.[I] then return 0 fi
end
return 1
End
What you a showing, I think, is a language that can index record
(or structure) members. In the posted C++, this is done by using
pointers to member functions. Both are key to one part of the OP's
problem but neither really gets to the heart of the OP's question --
how to represent (or denote) compound match predicates.
You mean how to specify which fields are to be compared and to what?
What from I could understand, the OP wanted to compare certain fields of
records A and B. A is input data and B is some reference data. In my code
example the fields are specified as a list of field numbers.
Another way was in Malcolm's example to put wildcards into B (or some
indicator to say 'ignore this field').
My example still stands, but Map disappears and the critical code (best read
as pseudo-code) becomes as follows. (My language just happens to have the
..fields attribute). This is a little less efficient however (must look at
all fields of B), but there are other possibilities too.
I don't think the requirements went any deeper than that and to avoid
writing 2**N laborious functions. My point was to show things could be kept
simple without dragging in external libraries.
Function Match(A, B)=
For i:=1 to A.Fields do
if B.[i]<>"*" and A.[i]<>B.[i] then return 0 fi
end
return 1
End
--
Bart
.
- Follow-Ups:
- Re: Decision Tables
- From: Ben Bacarisse
- Re: Decision Tables
- From: Leslie Sanford
- Re: Decision Tables
- References:
- Decision Tables
- From: Leslie Sanford
- Re: Decision Tables
- From: Ben Bacarisse
- Re: Decision Tables
- From: kwikius
- Re: Decision Tables
- From: Bartc
- Re: Decision Tables
- From: Ben Bacarisse
- Decision Tables
- Prev by Date: What makes a CD-ROM bootable?
- Next by Date: Re: help!
- Previous by thread: Re: Decision Tables
- Next by thread: Re: Decision Tables
- Index(es):
Relevant Pages
|