When it comes to examining arbitrary lists can Pilog be a good (as in terse)
and fast fit?

Take the following list for example: ("one" "two" ("items" "knife" "tent"
"hook" "boots") ("key1" "yes") ("key2" "no"))

We want to know if all of the following are true or not:
1.) It contains "one".
2.) It contains ("key1" "yes"), i.e. a member of the list is a in itself a
list with "key1" in the car and "yes" as the second element. If it makes
anything easier it can be assumed that this member will never have more than
two elements.
3.) It contains a member list with "items" in the car and both "boots" and
"tent" in the cdr.

The only alternative to Pilog the way I see it is to create some kind of
simple DSL that will work something like this algo-wise:
1.) Examine each element against the criteria list/tree.
2.) When a condition matches on an examined element we remove that criteria
from the criteria list/tree.
3.) If the criteria list/tree is empty we catch T.
4.) If we reach the end of the examined list and we still have something in
the criteria list we return NIL.

An input/DSL to this "engine" could perhaps look something like this:

((? "one") (? "key1" "yes") (? "items" "boots" "tent") (! "two"))

The last ! there should mean that the list can not contain "two" which
somehow needs to be treated as a normal positive search whose result is
inverted with catch NIL perhaps.

Any thoughts?

Reply via email to