Difference between revisions of "Reverse"
(Created page with "category:Transforming functions ''new to Analytica 4.7'' == Reverse( x'', I, posFirst, posLast'') == Reverses the items in array «x» along index «<code>I</code>»...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[category:Transforming functions]] | [[category:Transforming functions]] | ||
− | ''new to [[Analytica | + | ''new to [[Analytica 5.0]]'' |
== Reverse( x'', I, posFirst, posLast'') == | == Reverse( x'', I, posFirst, posLast'') == | ||
Line 21: | Line 21: | ||
== Notes == | == Notes == | ||
− | <code>Reverse(x,I)</code> is equivalent to <code>x[@I=size(I)+1-@I]</code>. | + | * <code>Reverse(x,I)</code> is equivalent to <code>x[@I=size(I)+1-@I]</code>. |
+ | |||
+ | * [[Reverse]] does not reverse the characters in a text value, since a text value is not an array. See [[User-Defined_Functions/User-defined_function_examples#Reverse_the_characters_in_a_text_value|TextReverse]] for a [[User-Defined Function]] that does this. | ||
== See also == | == See also == | ||
Line 27: | Line 29: | ||
* [[Subscript-Slice Operator]], [[Slice]]() | * [[Subscript-Slice Operator]], [[Slice]]() | ||
* [[Sort]], [[Sequence]] | * [[Sort]], [[Sequence]] | ||
+ | * [[User-Defined_Functions/User-defined_function_examples#Reverse_the_characters_in_a_text_value|TextReverse]] |
Latest revision as of 21:25, 25 February 2025
new to Analytica 5.0
Reverse( x, I, posFirst, posLast)
Reverses the items in array «x» along index «I
». The result is still indexed by «I
».
Use the optional «posFirst» and «posLast» to reverse the order of a sub-sequence along «I
».
Examples
Suppose
- Index J :=
1..6
- Variable a :=
J^2
Reverse(a,J) → Array(J, [ 36, 25, 16, 9, 4, 1 ])
Reverse(a,J,posFirst:3) → Array(J, [ 1,4, 36, 25, 16, 9 ])
Reverse(a,J,posLast:4) → Array(J, [ 16, 9, 4, 1, 25, 36 ])
Reverse(a,J,posFirst:3, posLast:5) → Array(J, [ 1, 4, 25, 16, 9, 36 ])
Notes
Reverse(x,I)
is equivalent tox[@I=size(I)+1-@I]
.
- Reverse does not reverse the characters in a text value, since a text value is not an array. See TextReverse for a User-Defined Function that does this.
See also
Comments
Enable comment auto-refresher