33 lines
958 B
Plaintext
33 lines
958 B
Plaintext
;- Set up two lists, one multi dimensional and one 1-D.
|
|
NewList A.RCList()
|
|
|
|
;- Create a deep list
|
|
With A()
|
|
AddElement(A()): AddElement(\A()): AddElement(\A()): \A()\Value=1
|
|
AddElement(A()): A()\Value=2
|
|
AddElement(A()): AddElement(\A()): \A()\Value=3
|
|
AddElement(\A()): \A()\Value=4
|
|
AddElement(A()): AddElement(\A()): \A()\Value=5
|
|
AddElement(A()): AddElement(\A()): AddElement(\A()): AddElement(\A())
|
|
AddElement(A()): AddElement(\A()): AddElement(\A()): \A()\Value=6
|
|
AddElement(A()): A()\Value=7
|
|
AddElement(A()): A()\Value=8
|
|
AddElement(A()): AddElement(\A()): AddElement(\A())
|
|
EndWith
|
|
|
|
Flatten(A())
|
|
|
|
;- Present the result
|
|
If OpenConsole()
|
|
Print("Flatten: [")
|
|
ForEach A()
|
|
Print(Str(A()\Value))
|
|
If ListIndex(A())<(ListSize(A())-1)
|
|
Print(", ")
|
|
Else
|
|
PrintN("]")
|
|
EndIf
|
|
Next
|
|
Print(#CRLF$+"Press ENTER to quit"): Input()
|
|
EndIf
|