Difference between revisions of "LL To RArray"
m (Lchrisman moved page LL to RArray to LL To RArray) |
(Prelim save during creation) |
||
Line 1: | Line 1: | ||
[[Category:Doc Status D]] <!-- For Lumina use, do not change --> | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | ||
+ | |||
+ | == LL_To_RArray( LL, indexName ) == | ||
+ | |||
+ | Converts a linked list to an array. A new local index is created having a length equal to the number of items in the linked list, with the name «indexName» (i.e., «indexName» is a text parameter). The items in the array are in the reverse order that they appear in the linked list, which means that they are in the same order that they were pushed onto the front of the linked list. | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | Var n := 27; | ||
+ | Var LL := null; | ||
+ | while (n>1) do ( | ||
+ | LL := LL_Push( LL, n ); | ||
+ | n := If Mod(n,2) Then 3*n+1 Else n/2 | ||
+ | ); | ||
+ | LL_to_rarray( LL, "step" ) |
Revision as of 21:03, 28 January 2016
LL_To_RArray( LL, indexName )
Converts a linked list to an array. A new local index is created having a length equal to the number of items in the linked list, with the name «indexName» (i.e., «indexName» is a text parameter). The items in the array are in the reverse order that they appear in the linked list, which means that they are in the same order that they were pushed onto the front of the linked list.
Examples
Var n := 27; Var LL := null; while (n>1) do ( LL := LL_Push( LL, n ); n := If Mod(n,2) Then 3*n+1 Else n/2 ); LL_to_rarray( LL, "step" )
Comments
Enable comment auto-refresher