entries - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


indices

indices of a table or array

entries

entries of a table or array

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Compatibility

Calling Sequence

indices(t)

indices(t, options)

entries(t)

entries(t, options)

Parameters

t

-

list, set, table, Array, Vector, Matrix, or object

options

-

(optional) optional arguments to control the output format

Description

• 

The indices and entries functions return sequences of the indices (or keys) and the entries respectively of the list, set, table, Array, Vector, Matrix, or container object t corresponding to the entries that are explicitly stored.

• 

By default, the result returned is a sequence of lists in an apparently arbitrary order. However, there is a one-to-one correspondence between the result of indices and entries. The 'indexorder' option can be specified to control the order of the returned elements.

• 

indices and entries support the following optional arguments.

• 

If the 'nolist' option is passed, the result returned is a simple sequence of values not enclosed within lists. This is useful for containers where every index or entry is known to be a single object. When 'nolist' is used on a container with expression sequence indices or entries, the groupings may be difficult or impossible to discern in the result.

• 

If the 'pairs' option is passed, the result returned is a sequence of index = entry pairs. Since the equation form can represent sequences on each side of the equation, neither each side nor the whole equation is wrapped in a list, regardless of the presence or absence of 'nolist'.

• 

If the 'output=Array' option is passed, the returned data is stored in an Array.  This is convenient because Arrays do not flatten sequences, and therefore the ith element can be a proper sequence.   As a result 'nolist' is implicitly always true with this option and cannot be overridden.

• 

If the 'indexorder' option is passed, the returned data is ordered based on the sorted order of the indices. The indices are sorted using the same algorithm as the command sortids,setorder. See the set order help page for more details.

  

A specific comparison function can be provided using 'indexorder'=func, where func is a procedure taking two arguments and returning true if and only if the first is to come before the second.

  

The 'indexorder' option is supported only for table, Array, Vector, and Matrix containers.

Thread Safety

• 

The indices and entries commands are thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

ttablegreen=gruen,red=rot,blue=blau,black=schwarz:

indicest

red,black,blue,green

(1)

entriest

rot,schwarz,blau,gruen

(2)

indicest,nolist

red,black,blue,green

(3)

indicest,pairs

red=rot,black=schwarz,blue=blau,green=gruen

(4)

indicest,indexorder

black,blue,green,red

(5)

entriest,indexorder

schwarz,blau,gruen,rot

(6)

indicest,`=`indexorder,x,ynotStringTools:−Comparex1,y1

red,green,blue,black

(7)

aArray1,2,3,4

a1234

(8)

indicesa

1,1,2,1,1,2,2,2

(9)

entriesa

1,3,2,4

(10)

entriesa,nolist

1,3,2,4

(11)

mMatrix3,2,2,1,4,4,5,8

m2−14458

(12)

indicesm

1,1,2,1,3,1,1,2,2,2,3,2

(13)

entriesm

2,4,5,−1,4,8

(14)

entriesm,pairs

1,1=2,1,2=−1,2,1=4,2,2=4,3,1=5,3,2=8

(15)

Compatibility

• 

The pairs option was introduced in Maple 15.

• 

For more information on Maple 15 changes, see Updates in Maple 15.

• 

The indexorder option was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

• 

The indices and entries commands were updated in Maple 2023.

• 

The output option was introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.

See Also

Array

list

Matrix

object

op

set

table

Vector