Previous Page Next Page Contents

listlib::insertAt -- insert an element into a list

Introduction

listlib::insertAt(list, element, pos) inserts element into list at position pos.

Call(s)

listlib::insertAt(list, element <, pos>)

Parameters

list - a list
element - any MuPAD object
pos - any integer

Returns

the given list enlarged with the inserted element

Related Functions

listlib::insert, append, _concat

Details

Example 1

Insertion 2 at the third place of the given list:

>> listlib::insertAt([1, 1, 1], 2, 3)
                               [1, 1, 2, 1]

Insertion of an element in front of a list. The third argument is optional in this case:

>> listlib::insertAt([1, 1, 3, 1], 2, 0), listlib::insertAt([1, 1, 3, 1], 2)
                     [2, 1, 1, 3, 1], [2, 1, 1, 3, 1]

Appending of an element. This could be done faster with append:

>> listlib::insertAt([1, 2, 3], 4, 1000), append([1, 2, 3], 4)
                        [1, 2, 3, 4], [1, 2, 3, 4]

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000