insert >>-insert(item-+--------+-)------------------------------------>< +-,index-+ Returns a list-supplied index for item [item] , which is added to the list. The inserted item follows an existing item with index [index] in the list ordering. If [index] is the Nil object, [item] becomes the first item in the list. If you omit [index] , the [item] becomes the last item in the list. Inserting an item in the list at position [index] will cause the items in the list after position [index] to have their relative positions shifted by the list object. The index values for any items in the list are not modified by the insertion. Directory class - insert method musketeers=.list~of("Porthos","Athos","Aramis") /* Creates list MUSKETEERS */ /* consisting of: Porthos */ /* Athos */ /* Aramis */ index=musketeers~first /* Gives index of first item */ musketeers~insert("D'Artagnan",index) /* Adds D'Artagnan after Porthos */ /* List is now: Porthos */ /* D'Artagnan */ /* Athos */ /* Aramis */ /* Alternately, you could use */ musketeers~insert("D'Artagnan",.nil) /* Adds D'Artagnan before Porthos */ /* List is now: D'Artagnan */ /* Porthos */ /* Athos */ /* Aramis */ /* Alternately, you could use */ musketeers~insert("D'Artagnan") /* Adds D'Artagnan after Aramis */ /* List is now: Porthos */ /* Athos */ /* Aramis */ /* D'Artagnan */ |