Dear CLIPS users and team!
Strange behavior I noticed in translation of str-length function:
ru@ru-sitrol:~/clips/VRGoogleEarthView$ ./clips/clips
CLIPS (6.4 2/9/21)
CLIPS> (deffunction test ()
(bind ?c "abbra caddabra")
(bind ?len (str-length ?с))
(if (and (neq ?c EOF)(eq (sub-string 1 2 ?c) "ab"))
then
(bind ?r (sub-string 3 4 ?c))))
[PRCCODE3] Undefined variable ?с referenced in deffunction.
ERROR:
(deffunction MAIN::test
()
(bind ?c "abbra caddabra")
(bind ?len (str-length ?с))
(if (and (neq ?c EOF) (eq (sub-string 1 2 ?c) "ab"))
then
(bind ?r (sub-string 3 4 ?c)))
)
CLIPS> (deffunction test ()
(bind ?c "abbra caddabra")
(bind ?len 5) ;(str-length ?с))
(if (and (neq ?c EOF)(eq (sub-string 1 2 ?c) "ab"))
then
(bind ?r (sub-string 3 4 ?c))))
CLIPS>
The presence of a function call causes an error.
Replacing the call with a constant eliminates the error!
Any comments would be great.
Sincerely,
Ru