$POS The integer function $POS is used to determine the position number in a set from the index or element name. Suppose that COM is the set (c1-c5) and that MARCOM is the set (c3,c4) which has been declared as a subset of COM. Then: $POS(c3,COM) = 3 $POS(c3,MARCOM) = 1 The first argument of $POS can also be an index. Thus Formula (all,c,COM) X(c) = $POS(c,COM) ; puts X(c1) equal to 1, X(c2) = 2, X(c3) = 3, X(c4) = 4 and X(c5) = 5. In the above formula, we could omit the second $POS argument, since c is already running over COM. That is, we could write: Formula (all,c,COM) X(c) = $POS(c) ; with identical results. $POS must be sure to find the sought element somewhere in the target set. Hence TABLO disallows the following formula: Formula (all,c,COM) X(c) = $POS(c,MARCOM); since COM is not a subset of MARCOM The example below shows how we can make a new set, COM, by inserting a new element, "PipeLine" into an existing set COM0. The new element is inserted just after the existing "RailTransprt" element. Set PART1 = (all,c,COM0:$pos(c)<=$pos("RailTransprt",COM0)); PART2 = COM0 - PART1; COM = PART1 + "PipeLine" + PART2; back to TABLO language contents URL of this topic: www.copsmodels.com/webhelp/tabmate/hc_pos.htm Link to full GEMPACK Manual Link to GEMPACK homepage |