In the official examples there is a dilemma1 file that contains the following snippet
(defrule MAIN::move-alone
?node <- (status (search-depth ?num)
(farmer-location ?fs))
(opposite-of ?fs ?ns)
=>
(duplicate ?node (search-depth =(+ 1 ?num))
(parent ?node)
(farmer-location ?ns)
(last-move alone)))
I noticed that the duplicate action uses the =(+ 1 ?num) syntax which I've previously seen only as a predicate/pattern for the left side within a defrule even though it appears on the right in this case.
Section 12.9.4 of the latest CLIPS Reference Manual describes the syntax of duplicate as follows:
(duplicate <fact-specifier> <RHS-slot>*)
The <RHS-slot> rule in Appendix G however does cover function calls and nested expression but it doesn't cover the = prefix. As such I'd like to know why this syntax is valid, what is means and whether the BNF in the manual is just not correct for this case.
It's vestigial syntax from a quarter century ago for compatibility. The syntax for CLIPS was based on ART, a LISP-based tool. ART support lists within lists, so the command
would create the fact
In order to perform a function call, you had to use the syntax
to create the fact
We eventually dropped the requirement for using = to signify a function call in the actions of the rule, but went ahead and kept it for the conditions of the rule because there was also the : constraint which invoked a function call as well as other constraints (&, |, and ~) which had no meaning when used in the actions of a rule.