Help Contents / Data Structure Primitives / Constructors / Array

Array size
(Array size origin)
Array alist
Array aintarray


outputs an array of "size" members (must be a positive integer), each of which initially is an empty list. Array members can be selected with Item and changed with setItem. The first member of the array is member number 1 unless an "origin" input (must be an integer) is given, in which case the first member of the array has that number as its index. (Typically 0 is used as the origin if anything.) Arrays are printed by PRINT and friends, and can be typed in, inside curly braces. @ indicates an origin. This primitive also can be used to convert alist, aint16array or aintarray to an array, and to clone the array anarray. 

Examples: 

	show array 3		;{[] [] []} 
	show (array 3 0)		;{[] [] []}@0 
	show {h a l l o}		;{h a l l o} 
	show {a b c}@2		;{a b c}@2 
	show Item 3 {a b c}@2	;b 

	a={H a l l o} 
	setItem 2 a "e 
	show a		;{H e l l o} 
	Array [1 2 3]	;{1 2 3}  ;-) 
	Array intarray [1 2 3]	;{1 2 3}  ;-) 
	Array int16array [1 2 3]	;{1 2 3}  ;-) 


previous: lPut	next: IntArray
