Index Position Operator::@

Revision as of 18:30, 2 February 2007 by Lchrisman (talk | contribs) (added see also)


(new to 4.0)

The position operator returns the numeric position of elements in an index. The first element of an index is at position 1, the last element of an index is at position size(I), etc.

Usages:

The position operator may be used in the following syntactical forms:

@I          -- Returns an array indexed by I with elements from 1..size(I)
@[I=x]      -- Returns the position of x in index I
expr[@I=n]  -- The nth Slice of expr along index I.

Examples

We'll use the following indexes for illustration:

Index Car_type := ['VW','Honda','BMW']
Index Time := [0,1,2,3,4]
@CarType -->
Car_Type >>
'VW' 'Honda' 'BMW'
1 2 3
@[Car_type='Honda'] --> 2
Car_type[@Car_type=2] --> 'Honda'
@Time -->
Time >>
0 1 2 3 4
1 2 3 4 5
@[Time=2] --> 3
Time[@Time=3] --> 2
(Time+2007)[@Time=3] --> 2009

Notes

@I is equivalent to Cumulate(1,I)

See Also

Comments


You are not allowed to post comments.