Hi Hal, Clean up your code a bit, and I think it works fine. :-) ; hal.clp (clear) (watch all)
(deftemplate functional-fact (slot func)) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) ; PROGRAM (reset) (assert (functional-fact (func (lambda (?x) (> 1 ?x))))) (run) ; OUTPUT ;--------------------------------------------------- ; Jess> (batch "hal.clp") ; TRUE ; Jess> (batch "hal.clp") ; MAIN::test-me: +1+1+1+t ; ==> Focus MAIN ; ==> f-0 (MAIN::initial-fact) ; ==> f-1 (MAIN::functional-fact (func <LAMBDA>)) ; ==> Activation: MAIN::test-me : f-1 ; FIRE 1 MAIN::test-me f-1 ; 1 > 0 ; <== Focus MAIN ; 1 ; Jess> Cheers, Jason On Thu, Aug 14, 2008 at 11:23 AM, Hal Hildebrand <[EMAIL PROTECTED]>wrote: > 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. > > -- ----------------------------------------------------------- Jason Morris Morris Technical Solutions LLC [EMAIL PROTECTED] (517) 304-5883