Strange behavior in translation of str-length function

27 views
Skip to first unread message

Руслан Сорокин

unread,
Nov 11, 2024, 4:49:09 AM11/11/24
to CLIPSESG
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

CLIPS Support

unread,
Nov 11, 2024, 9:23:23 PM11/11/24
to CLIPSESG
The name for the variable you're passing to the str-index function looks like a c, but it's not a c. When I copy and paste that character and compare it to a c I typed, the eq function returns FALSE. When I compare two c characters I've typed, it returns true.

         CLIPS (6.4.1 4/8/23)
CLIPS> (eq с c)
FALSE
CLIPS> (eq c c)
TRUE
CLIPS> 

Alex Gian

unread,
Nov 12, 2024, 2:52:16 AM11/12/24
to clip...@googlegroups.com
Russian lower case "Es" (0x1089)
The tribulations of those of us using dual keyboard maps!  So easy to do.

--
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To post to this group, send email to CLIP...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/CLIPSESG?hl=en
 
--> IF YOU NO LONGER WANT TO RECEIVE EMAIL <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Click on "Edit my membership" link.
Select the "No Email" radio button.
Click the "Save these settings" button.

--> IF YOU WANT TO UNSUBSCRIBE <--
Visit this group at http://groups.google.com/group/CLIPSESG?hl=en
Sign in
Click on "Edit my membership" link.
Click the "Unsubscribe" button.
Note: This appears to be the most reliable way to unsubscribe
 
Alternately, send email to CLIPSESG-u...@googlegroups.com. You will receive an email which you must respond to as well to unsubscribe. Clicking the link mentioned in the unsubscribe reply does not appear to work reliably.
---
You received this message because you are subscribed to the Google Groups "CLIPSESG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clipsesg+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/clipsesg/fa57b385-1907-4b9e-9336-68c34032da8en%40googlegroups.com.

Руслан Сорокин

unread,
Nov 12, 2024, 6:06:28 AM11/12/24
to CLIPSESG
Thank you  both very much! I suspected this and copied and pasted several times like Gary. But seems not enough :)
Sorry!

Sincerely,
  Ru

вторник, 12 ноября 2024 г. в 10:52:16 UTC+3, Alex Gian:
Reply all
Reply to author
Forward
0 new messages