[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Array of structures.



Hi.

I'd like to build an array of structure using one line. Something like
that:

arr = [{sig:a, color:'red'}, {sig:b, color:'green'}]

I don't want to use the replicate function and then fill the array one
by one:

arr = replicate({myStruct, sig:a, color:'red'}, 2)
arr[0] = {myStruct, sig:a, color:'red'}
arr[1] = {myStruct, sig:b, color:'green'}

Any suggestions ?

Thanks.

Nicolas.

ps: In fact, I'm trying to find a way to handle lists of anything. In
the present case I want to pass as one argument a list of signals
(arrays of value) associated with a color. The list must be of any size,
we must be able to build it on the fly. Something like that : {{sig1
'red'} {sig2 'green'}} in a Tcl-like syntax.

--
Tél. : 00 (33) 5 62 88 11 16
Fax  : 00 (33) 5 62 88 11 12
Nicolas.Decoster@Noveltis.fr

Noveltis
Parc Technologique du Canal
2, avenue de l'Europe
31520 Ramonville Saint Agne - France