Search code examples
clips

How to format a string in CLIPS?


I need to format a string, but even if I copy a seemingly correct code, the CLIPS interpreter signals me an error.

(format nil "Integer: |% ld|" 12)

“I expect the output of "Integer: |12|" but the CLIPS interpreter signals me an error.enter image description here


Solution

  • There should be no space between the % character and the format flag. Also the character 'l' is not a valid format flag.

    CLIPS> (format nil "Integer: |%d|" 12)
    "Integer: |12|"
    CLIPS>