无法在 CLIPS 中实现 Bind 功能

Cant implement function on Bind in CLIPS

(deffunction slabV10071 ( ?totalQuantity ?quantityBuilder )
    (bind ?promoQuantities (integer (/ ?totalQuantity 6)))
    if(>= ?totalQuantity 12) then
    (assert(Output (promoId V10071)(promotionTypeCode 1)(productIds 3089 2264 2090 )(quantities ?quantityBuilder)(uom EA)(promoQuantities ?promoQuantities)(values  1666.6666666)(rewardId  3089,2264,2090)(repeatingRange 1)(proRata N)(exclusionFlag 1)(sequenceNumber 3335)(effectiveFrom 2020-05-27)))
    (return))(bind ?promoQuantities (integer (/ ?totalQuantity 12)))
    if(>= ?totalQuantity 6) then
    (assert(Output (promoId V10071)(promotionTypeCode 1)(productIds 3089 2264 2090 )(quantities ?quantityBuilder)(uom EA)(promoQuantities ?promoQuantities)(values  1700)(rewardId  3089,2264,2090)(repeatingRange 1)(proRata N)(exclusionFlag 1)(sequenceNumber 3335)(effectiveFrom 2020-05-27)))
    (return)))
(defrule V10071
(exists (Product(productId 3089)(quantity ?q&:(> ?q 1))(date ?orderDate&:(<= 20200527 ?orderDate 20201231))))
=>
(bind ?totalQuantity 0)
(bind ?quantityBuilder "")
(do-for-all-facts ((?p Product))
(or (eq ?p:productId 3089)
(eq ?p:productId 2264)
(eq ?p:productId 2090)
)
(bind (str-cat ?quantitybuilder ?p:quantity " " ))
(bind ?totalQuantity (+ ?totalQuantity ?p:quantity)))
(if(>= ?totalQuantity 1) then
(slabV10071 ?totalQuantity ?quantityBuilder)))

这是代码。 slabV10071 函数运行良好。但是在规则中我得到了错误

[PRNTUTIL2] 语法错误:检查绑定函数的适当语法。

[PRNTUTIL2] 语法错误:检查事实集查询函数的适当语法。

请帮忙。

错误消息显示了您的规则中发生错误的位置:

ERROR:
(defrule MAIN::V10071
   (exists
        (Product (productId 3089) (quantity ?q&:(> ?q 1)) (date ?orderDate&:(<= 20200527 ?orderDate 20201231))))
   =>
   (bind ?totalQuantity 0)
   (bind ?quantityBuilder "")
   (do-for-all-facts ((?p Product))
      (or (eq ?p:productId 3089) (eq ?p:productId 2264) (eq ?p:productId 2090))
      (bind(

这是导致错误的代码行:

(bind (str-cat ?quantitybuilder ?p:quantity " " ))

您没有提供函数调用将绑定到的变量。这可能是您想要的:

(bind ?quantitybuilder (str-cat ?quantitybuilder ?p:quantity " " ))