; Bob Kirby
Praise be the heady power of declarative programming!
- Mike Smith
--- Begin Message ---
Title: Re: JESS: LHS, lists and productions.
Thanks! This is exactly what I need. As you can see in my follow up email, I tried to do this transformation, but for some odd reason – I think i
Ernest,
is it overlook or allowed?
I though that each independent variable has to have distinct name within a
rule. Your fact ?t should be different from template ?t if templates in a
multislot are symbols.
Dusan Sormaz
At 12:11 PM 9/7/2007, you wrote:
Same idea:
(defrule removeTransform
Ah. Should have paid more attention to the details.
This has been a tremendous help and my rules make much more sense and don't
have that really ugly feel to them.
Thanks!
On 9/7/07 10:32 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote:
>
> On Sep 7, 2007, at 1:01 PM, Hal Hildebrand wro
On Sep 7, 2007, at 1:01 PM, Hal Hildebrand wrote:
I guess I'm more than a little confused as to the "(templates $? ?t
$?)"
syntax.
Remember that the first time a variable is used, it matches
whatever's there, and subsequent uses of that same variable match
only whatever the first usage
Thanks! This is exactly what I need. As you can see in my follow up email,
I tried to do this transformation, but for some odd reason I think it was
my placement of (watch all) - I didn¹t see all the assertions. However, I
still have the endless loop issue if I combine this with the
removeTran
I guess I'm more than a little confused as to the "(templates $? ?t $?)"
syntax. I would have expected that I could have rewritten the rule Wolfgang
provided to:
(defrule makeTransforms
?s <- (source (id ?id) (templates $? ?template $?))
(not (transform (source ?id)))
=>
(assert (
This can all be combined in a single rule without a "foreach" loop.
(defrule manage-source-templates
"Logically assert or retract templates for source"
(logical (source (id ?id) (templates $? ?template $?)))
(not (transform (source ?id) (template ?template)))
=>
(assert (transf
Same idea:
(defrule removeTransforms
?t <- (transform (source ?id) (template ?t))
(not (source (id ?id)(templates $? ?t $?))
=>
(retract ?t))
On Sep 7, 2007, at 11:57 AM, Hal Hildebrand wrote:
Doh! That does work well and I'll certainly replace my cheesy
solution with
this, but
Doh! That does work well and I'll certainly replace my cheesy solution with
this, but one of the issues I'm dealing with is that the set of templates
can change and I would like to ensure that as changes to the list of
templates occur, the corresponding transforms are asserted or retracted.
Sorry,
Assuming that the absence of any "transform" fact with a "source" slot
equal to the "id" slot of a new "source" fact is the criterion for
creating the "transform" facts:
(defrule makeTransforms
?s <- (source (id ?id)(templates $?templates))
(not (transform (source ?id)))
=>
(foreach ?tem
I have a system where I need to ensure that for every member of a list,
there is a fact which contains that member. For example, here's my domain:
(deftemplate source (slot id) (multislot templates))
(deftemplate transform (slot source) (slot template))
What I would like is to write some rules
11 matches
Mail list logo