Scilab object and list function definition
list(a1,....an)
Creates a list with elements ai‘s which are arbitrary Scilab objects ( matrix, list,...). Type of list objects is 15. list() creates the empty list (0 element).
: :append an element in queue L($+1)=e. : :append an element in head L(0)=e. (note that after this operation
e is at index 1, the initial elements being shifted on the right).
: :deletion L(i)=null() removes the i-th element of the list L. : :concatenation of two lists L3 = lstcat(L1,L2). : :number of elements of a list you can use either nb_elm = size(L)
or nb_elm = length(L).
:
Scilab provides also other kinds of list, the tlist type (typed list) and the mlist type which are useful to define a new data type with operator overloading facilities (hypermatrices which are multi-dimensionnal arrays in scilab are in fact mlist).
Matlab struct are also available.
l = list(1,["a" "b"])
l(0) = "foo"
l($+1) = "hello"
l(2) = "toto"
l(3) = `rand`_(1,2)
l(3) = `null`_()
lbis = list("gewurtz", "caipirina" ,"debug")
lter = `lstcat`_(l,lbis)
`size`_(lter) - `size`_(lbis) - `size`_(l) // must be zero