Search code examples
clips

How to create an integer array on RHS of an rule in CLIPS


how can we create an integer array on rhs side of clips..

I tried

 (bind ?new_ints (numbers ?new_count ?new_bad_count ?new_good_count))

The idea is that new_count, new_bad_count, new_good_count should go into new_ints.

and it's not working.


Solution

  • There is no primitive data type in CLIPS for multi-dimensional arrays. You can use a multifield value to represent one-dimensional arrays:

    CLIPS> (bind ?array (create$ 1 2 3))
    (1 2 3)
    CLIPS> (nth$ 3 ?array)
    3
    CLIPS> (length$ ?array)
    3
    CLIPS>