An alternative that would permit you to manipulate your facts
in a somewhat second-order manner is to define a predicate such as my-fact
and then use:
(assert (my-fact ?foo ?bar))
This way, ?foo is no longer a predicate but instead is a term within the fact
----- Original Message -----
From: Friedman-Hill, Ernest
Sent: Monday, April 16, 2012 10:27 AM
Subject: Re: JESS: [EXTERNAL] Second order JESS?
You can build the fact you want as a string and assert that — for example
(assert-string (str-cat "(" ?foo " " ?bar ")"))
From: Sam Sarjant <sj...@waikato.ac.nz>
Date: Sun, 15 Apr 2012 13:21:47 +1200
Subject: JESS: [EXTERNAL] Second order JESS?
I'm looking to use JESS within an application where second-order logic is
needed (or at least it makes things easier). Does JESS support second-order
logic in any form?
For example, a rule such as:
(ruleDef (factPredicate ?foo) (factArgs ?bar))
(assert (?foo ?bar)))
is an example of the structure I am looking for (where factPredicate is a
String slot and factArgs is a multislot). The LHS of the rule compiles fine
(with the appropriate ruleDef deftemplate), but the RHS throws an exception as
it is expecting a template name after assert.
- Thanks, Sam Sarjant