Difference between revisions of "Implicit index"
(Created page with " Implicit index (also known as a ''null-index'') is an index that does not have a name. Because it has no name, there is no way to refer to it in expressions where i...") |
|||
Line 1: | Line 1: | ||
+ | [[Category: Arrays]] | ||
− | [[Implicit index]] (also known as a ''null-index'') is an [[index]] that does not have a name. | + | An [[Implicit index]] (also known as a ''null-index'') is an [[index]] that does not have a name, e.g. a list (a 1-dimensional array) with its single dimension not explicitly named. |
− | Because | + | Because an implicit index has no name, it is not possible to refer to it in [[expressions]] where index [[parameters]] are expected. |
+ | |||
+ | Most built-in Analytica [[functions]] can still be employed to operate over implicit indexes, e.g. the [[Subset]] function with the optional «position» parameter: | ||
+ | |||
+ | :<code>Subset(1997..2008 > 2005, position: true) → [10, 11, 12] </code> -- returns positions of elements | ||
+ | |||
+ | vs | ||
+ | |||
+ | :<code>Index Years := 1997..2008</code> | ||
+ | :<code>Subset(Years > 2005) → [2006, 2007, 2008] </code> -- returns index values | ||
To avoid ambiguity, Analytica does not allow more than one implicit index in an [[array]]. If you try to combine multiple arrays with implicit indexes, it will cause an [[Error Messages/40045|error]]. | To avoid ambiguity, Analytica does not allow more than one implicit index in an [[array]]. If you try to combine multiple arrays with implicit indexes, it will cause an [[Error Messages/40045|error]]. | ||
− | When an implicit index reaches the top level of an expression, it is promoted to | + | When an implicit index reaches the top level of an expression, it is promoted to a [[Self index]]. |
− | |||
− | |||
− | Indexes that do have a name, are called ''explicit indexes'' and define ''explicit dimensions'', e.g. <code>Index I := 1..10</code> | + | Implicit indexes define [[Implicit Dimensions|implicit dimensions]], e.g. <code>(-3..3)</code> or <code>[-3, -2, -1, 0, 1, 2, 3]</code>. Indexes that do have a name, are called ''explicit indexes'' and define ''explicit dimensions'', e.g. <code>Index I := 1..10</code>. |
==See Also== | ==See Also== |
Revision as of 21:45, 4 August 2016
An Implicit index (also known as a null-index) is an index that does not have a name, e.g. a list (a 1-dimensional array) with its single dimension not explicitly named.
Because an implicit index has no name, it is not possible to refer to it in expressions where index parameters are expected.
Most built-in Analytica functions can still be employed to operate over implicit indexes, e.g. the Subset function with the optional «position» parameter:
Subset(1997..2008 > 2005, position: true) → [10, 11, 12]
-- returns positions of elements
vs
Index Years := 1997..2008
Subset(Years > 2005) → [2006, 2007, 2008]
-- returns index values
To avoid ambiguity, Analytica does not allow more than one implicit index in an array. If you try to combine multiple arrays with implicit indexes, it will cause an error.
When an implicit index reaches the top level of an expression, it is promoted to a Self index.
Implicit indexes define implicit dimensions, e.g. (-3..3)
or [-3, -2, -1, 0, 1, 2, 3]
. Indexes that do have a name, are called explicit indexes and define explicit dimensions, e.g. Index I := 1..10
.
Enable comment auto-refresher