Next: total, Previous: threecolors, Up: Internal Routines [Contents][Index]

`tolookup, `

`src`, `list`, `index`

Determines a lookup table for

in `src`

such
that `list`

contains no duplicate members, and
`list`

contains an index to the member of `index`

that corresponds to each member of `list`

.
`src`

If

has only one dimension, then `src`

has
the same number of elements as `index`

, and `src`

has the number of elements equal to the number of unique members of
`list`

. In that case, `src`

is an
exact copy of `list`(`index`)

.
`src`

If

has more than one dimension, then its last dimension
is taken to contain the numbers that define each member, and the
remaining dimensions select the different members. In that case,
`src`

gets two dimensions: the first one loops over all
unique members, the second one contains the defining numbers for each
member (and has the same dimension as the last dimension of
`list`

). Then, `list`

gets all but the last
dimension of `index`

.
`src`

For example, if

is a 2 by 3 by 4 array, then it is
taken to contain six (2 times 3) individual members which are each
characterized by 4 numbers (e.g., the second member is
`src`

). If there are three unique 4-element members
in `src`(1,0,*)

, then
`src``tolookup,`

yields
`src`,`list`,`index`

as a 3 by 4 array and `list`

as a 2 by 3
array. In that case, `index`

is equal to
`src`(0,0,*)

, and `list`(`index`(0,0))

to
`src`(1,2,*)

, and in general `list`(`index`(1,2))

equal to `src`

.
`list`(`index`,*)