Ernest Friedman-Hill wrote:

(defrule crossover
?e <- (side (name ?ename) {occup == FALSE})
?w <- (side (name ?wname) {occup == TRUE})
?br <- (bridge (name ?bname){occup == FALSE}
(east $east){east == ?e}
(west $west){west == ?w})
=>
(printout t ?bname " " ?ename " " ?wname crlf)
)


Unfortunately these "simple patterns" have confusing semantics, so they're being redefined somewhat for Jess 7.1. The confusing thing is that a name like "occup" in the above represents a variable that is bound automatically to the value of the first slot in which its used. If you use the same name later in the rule, that variable represents a unification -- i.e., the same value.

Very well hidden ;-)

One other system I know of lets you write (adopting the Jess syntax)

(defrule crossover
?e <- (side {?e.occup == FALSE}) ; or some way of saying "this"?
?w <- (side {?w.occup == TRUE})
?br <- (bridge {?br.occup == FALSE}
{?br.east == ?e}
{?br.west == ?w})
=>
(printout t ?br.name " " ?e.name " " ?w.name crlf)

But this implies that binding a fact also binds all slots automatically, and I can't say what this would mean for Jess. (That other system maps a fact to a C-like struct variable, and therefore the above notation comes for free.)



--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to