RE: JESS: multiple bindings of a multislot
"Friedman-Hill, Ernest" <[email protected]> Mon, 15 Aug 2011 14:53:06 +0000
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <[email protected]> |
Yes, "reopening" a slot like this is an error; this behavior was inherited from CLIPS. I can't think of any particularly elegant workarounds. You can name those anonymous multifields and refer to them later in the rule, though -- i.e., (Temp (m $?first one two $?rest) "?first" and "?rest" can be used elsewhere in the same rule to refer to what came before and after "one two". ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of Wolfgang Laun Sent: Sunday, August 14, 2011 2:30 PM To: jess-users Subject: JESS: multiple bindings of a multislot Given (deftemplate Temp (multislot m)) Cursory tests seem to indicate that a Temp pattern may be written with just a single set of clusters consisting of '?', '$?' and their named cousins. As an example, it's possible to write (Temp (m $? one two $?)) but not (Temp (m $? one two $?)(m $?mvals)) to ascertain that "one" and "two" occur as indicated and to bind ?mvals to the entire list. There is, of course, the workaround to use (Temp) once more, making sure that the facts are the same, but this is rather a lot to write for a relatively simple thing. Is it correct that one (multi)slot cannot be used more than once in a single pattern (except as a variable between braces)? -W -------------------------------------------------------------------- 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]. --------------------------------------------------------------------