I would like to have functions contained in the slot value of a fact
and then apply them. I can create and assign the function values by
using (lambda ...), which seems to be what I'm looking for on that
side of the equation:
(deftemplate functional-fact
(slot func)
)
(assert (functional-fact (func (lambda (?x) (> 1 ?x)))))
However, the question becomes how do I actually call this function?
What I would like to do is use these in test CE:
(deftemplate functional-fact
(slot func)
)
(assert (functional-fact (func (lambda (?x) (> 1 ?x)))))
(defrule test-me
(functional-fact (func ?function))
(test (?function 0))
=>
(printout t "1 > 0" crlf))
However, this does not work as I would expect instead failing with:
Jess reported an error in routine call
while executing (call ?function 0)
while executing 'test' CE
while executing rule LHS (TECT).
Message: No method named '0' found in class jess.Deffunction.
Program text: ( defrule test-me ( functional-fact ( func ?
function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0"
crlf ) ) at line 11.
Clearly, I'm not understanding this and would appreciate any help from
those on the list.
Thanks.