next up previous

12.2.10 Inserting Fields within a Multifield Value

This function inserts a series of single-field and/or multifield values at a specified location in a multifield value with and returns a new multifield value containing the inserted values within the original multifield value.

Syntax

(insert$ <multifield-expression>
               <integer-expression>
               <single-or-multi-field-expression>+)

where <integer-expression> is the location where the values are to be inserted. This value must be greater than or equal to 1. A value of 1 inserts the new value(s) at the beginning of the <multifield-expression>. Any value greater than the length of the <multifield-expression> appends the new values to the end of the <multifield-expression>.

Example

CLIPS> (insert$ (create$ a b c d) 1 x)
(x a b c d)
CLIPS> (insert$ (create$ a b c d) 4 y z)
(a b c y z d)
CLIPS> (insert$ (create$ a b c d) 5 (create$ q r))
(a b c d q r)
CLIPS>


next up previous