Re: Decision Tables
- From: kwikius <andy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 01:19:07 -0800 (PST)
On Jan 30, 12:11 am, Ben Bacarisse <ben.use...@xxxxxxxxx> wrote:
kwikius <a...@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:
<snip most of the code, but it enables this:>
int main()
{
D d1("John","Smith","England");
D d2("John","Jones","England");
typedef Dpred<&D::first_name> d_first_name;
typedef Dpred<&D::last_name> d_last_name;
typedef Dpred<&D::country> d_country;
std::cout << (d_first_name(d1,d2) && d_last_name(d1,d2) &&
d_country(d1,d2)) << '\n';
d_first_name first_name(d1,d2);
d_last_name last_name(d1,d2);
d_country country(d1,d2);
std::cout << (first_name && (last_name || country)) << '\n';
std::cout << (first_name && !last_name && country) << '\n';
}
I may be missing your point, but I *think* the OP wanted a way to
"store" (or at least represent) compound predicates which can the be
evaluated against an unknown data item. I don't think your example
shows this.
Maybe :-)
I took your pseudocode:
"
complex_match[] = { match_contry, match_not, match_first_name,
match_or, NULL };
"
which is a static expression, and with the stack machine the language
is something like Forth ?
and I figured that it wasnt very easy to read the expression syntax
and the solution seemed a prime candidate for C++ operator
overloading. Again the expression is statically evaluated.
Once happy with the syntax, you could write a script which mirrors
the C++ syntax:
"first_name && (last_name || country)"
which is IMO easier to comprehend than:
"match_country match_not, match_first_name,
match_or"
Anyway I would guess the simplest solution would be a database and
SQL.
regards
Andy Little
.
- Follow-Ups:
- Re: Decision Tables
- From: Ben Bacarisse
- Re: Decision Tables
- References:
- Decision Tables
- From: Leslie Sanford
- Re: Decision Tables
- From: Ben Bacarisse
- Re: Decision Tables
- From: kwikius
- Re: Decision Tables
- From: kwikius
- Re: Decision Tables
- From: Ben Bacarisse
- Decision Tables
- Prev by Date: Re: help!
- Next by Date: Re: help!
- Previous by thread: Re: Decision Tables
- Next by thread: Re: Decision Tables
- Index(es):
Relevant Pages
|