This task is about arrays.

For hashes or associative arrays, please see Creating an Associative Array.

For a definition and in-depth discussion of what an array is, see Array.



Task

Show basic array syntax in your language.

Basically, create an array, assign a value to it, and retrieve an element   (if available, show both fixed-length arrays and
dynamic arrays, pushing a value into it).

Please discuss at Village Pump:   Arrays.

Please merge code in from these obsolete tasks:

   Creating an Array
   Assigning Values to an Array
   Retrieving an Element of an Array


Related tasks

   Collections
   Creating an Associative Array
   Two-dimensional array (runtime)


Welcome to Quackery.

Enter "leave" to leave the shell.

Building extensions.

/O> ( nests are dynamic arrays, zero indexed from the left, -1 indexed from the right )
... 

Stack empty.

/O> []                ( create an empty nest )
... 23 join 24 join   ( append two numbers   )
... ' [ 33 34 ]       ( create a nest of two numbers )
... join              ( concatenate them )
... ' [ 45 46 ]       ( create a nest of two numbers )
... nested join       ( add that nest as an item of the nest )
... 

Stack: [ 23 24 33 34 [ 45 46 ] ] 

/O> ' [ 55 56 ]       ( create a nest of two numbers )
... swap 2 stuff      ( insert it into the previous nest as the 2nd item )
... 

Stack: [ 23 24 [ 55 56 ] 33 34 [ 45 46 ] ] 

/O> -3 pluck drop     ( remove the third item from the end and dispose of it )
... 

Stack: [ 23 24 [ 55 56 ] 34 [ 45 46 ] ] 

/O> dup 0 peek        ( copy the first item )
... 

Stack: [ 23 24 [ 55 56 ] 34 [ 45 46 ] ] 23 

/O> swap -1 poke      ( ... and overwrite the last item with it )
... 

Stack: [ 23 24 [ 55 56 ] 34 23 ] 

/O> behead join      ( remove the first item and append it to the end )
... 

Stack: [ 24 [ 55 56 ] 34 23 23 ] 

/O> -2 split nip     ( split it two items from the end and dispose of the left hand side )
... 

Stack: [ 23 23 ] 

/O> ' ** join        ( append the exponentiation word )
... 

Stack: [ 23 23 ** ] 

/O> do               ( ... and perform the nest as Quackery code. )
... 

Stack: 20880467999847912034355032910567 