ARS. - Container Cloning

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > ARS. - Array's > !ARS. - Container Cloning >

ARS. - Container Cloning

ARS.ToStack

Previous Top Next


MiniRobotLanguage (MRL)

 

ARS.ToStack

Converts an array to a stack container.

 

 

Intention

 

The ARS.ToStack command converts an array to a stack container. This is useful for integrating array operations with stack operations.

 

Illustration:

📦 Array: [1, 2, 3, 4, 5]
🔑 Handle: $$ARR
🔄 Converted to Stack: [1, 2, 3, 4, 5]
🔑 New Handle: $$STK

 

Syntax

 

ARS.ToStack|$$ARR[|$$STK]

 

 

Parameter Explanation

 

P1 - $$ARR - (Variable)

The handle of the array to convert to a stack.

 

P2 - $$STK (optional) - (Variable)

The variable to store the handle of the new stack. If omitted, the handle is placed on the Top of Stack (TOS).

 

Example

 

'***********************************

' ARS.ToStack - Sample 1

'***********************************

ARS.New|$$ARR

ARS.Add|$$ARR|1

ARS.Add|$$ARR|2

ARS.Add|$$ARR|3

ARS.Add|$$ARR|4

ARS.Add|$$ARR|5

ARS.ToStack|$$ARR|$$STK

DBP.New Stack: [1, 2, 3, 4, 5]

STK.End|$$STK

'

'***********************************

' ARS.ToStack - Sample 2

'***********************************

ARS.New|$$ARR|i

ARS.Add|$$ARR|100

ARS.Add|$$ARR|200

ARS.Add|$$ARR|300

ARS.Add|$$ARR|400

ARS.Add|$$ARR|500

ARS.ToStack|$$ARR

DBP.New Stack: [100, 200, 300, 400, 500]

STK.End|$$STK

'

'***********************************

' ARS.ToStack - Sample 3

'***********************************

ARS.New|$$ARR|f

ARS.Add|$$ARR|1.1

ARS.Add|$$ARR|2.2

ARS.Add|$$ARR|3.3

ARS.Add|$$ARR|4.4

ARS.Add|$$ARR|5.5

ARS.ToStack|$$ARR|$$STK

DBP.New Stack: [1.1, 2.2, 3.3, 4.4, 5.5]

STK.End|$$STK

'

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: