Business Shell (BUSH) Guide
Author: Ken Burtch

Home Page | Introduction | Tutorials | Reference | Packages | Hacking

Packages
4.1 Using Packages
4.2 text_io (Console I/O)
4.3 text_io (File I/O)
4.4 sound
4.5 source_info
4.6 System
4.7 numerics
4.8 strings
4.9 command_line
4.10 lock_files
4.11 cgi
4.12 calendar
4.13 units
4.14 arrays
4.15 files
4.16 db (Database)
4.17 stats
4.18 pen
4.19 mysql
4.20 os
4.21 directory_operations
| This part of the guide contains detailed descriptions of the BUSH built-in packages. ### 4.14 Arrays Package The arrays package provides general routines pretaining to BUSH arrays. This includes determining the size of the array, sorting the array or moving the items in the array. GCC Ada Equivalent: array attributes, GNAT sort packages i := arrays.bubble_sort( a )
Bubble sort the array, treating the elements as strings or numbers depending on the element type. Example: arrays.bubble_sort( sales_array ); Ada Equivalent: Uses GNAT.Bubble_Sort. Parameters:
a | in out | any array type | required | the array to sort
arrays.bubble_sort_descending( a )
Bubble sort the array in descending order, treating the elements as strings or numbers depending on the element type. Example: arrays.bubble_sort_descending( sales_array ); Ada Equivalent: Uses GNAT.Bubble_Sort. Parameters:
a | in out | any array type | required | the array to sort
i := arrays.first( a )
Return the first (lowest) index of the array. Example: i := arrays.first( sales_array ); Ada Equivalent: 'first attribute Parameters:
a | in | array type | required | the array with the index
i | return value | enumerated or numeric | required | the array's first bound
arrays.heap_sort( a )
Heap sort the array, treating the elements as strings or numbers depending on the element type. Example: arrays.heap_sort( sales_array ); Ada Equivalent: Uses GNAT.Heap_Sort. Parameters:
a | in out | any array type | required | the array to sort
arrays.heap_sort_descending( a )
Heap sort the array in descending order, treating the elements as strings or numbers depending on the element type. Example: arrays.heap_sort_descending( sales_array ); Ada Equivalent: Uses GNAT.Heap_Sort. Parameters:
a | in out | any array type | required | the array to sort
i := arrays.last( a )
Return the last (highest) index of the arrays Example: i := arrays.last( sales_array ); Ada Equivalent: 'last attribute Parameters:
a | in | array type | required | the array with the index
i | return value | enumerated or numeric | required | the array's last bound
n := arrays.length( a )
Return the number of elements in the array (last index - first index + 1). Example: n := arrays.length( sales_array ); Ada Equivalent: 'length attribute Parameters:
a | in | array type | required | the array to examine
n | return value | natural | required | the number of elements in the array
arrays.reverse( a )
Reverse the order of the elements in the array, moving the last element to the first position and the first element to the last position. Example: arrays.reverse( backwards_array ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to reverse
arrays.rotate_left( a )
Move all elements of the array one element toward the first position, moving the first element to the last position. Example: arrays.rotate_left( work_queue ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to rotate
arrays.rotate_right( a )
Move all elements of the array one element toward the last position, moving the last element to the first position. Example: arrays.rotate_right( work_queue ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to rotate
arrays.shift_left( a )
Move all elements of the array one element toward the first element, overwriting the first element. Example: arrays.shift_left( work_stack ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to rotate
arrays.shift_right( a )
Move all elements of the array one element toward the last element, overwriting the last element. Example: arrays.shift_right( work_stack ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to rotate
arrays.shuffle( a )
Randomize the elements of the array. Example: arrays.shuffle( playing_card_array ); Ada Equivalent: N/A Parameters:
a | in out | any array type | required | the array to shuffle
Back to Top