#!/usr/local/bin/spar pragma annotate( summary, "arraycat" ) @( description, "Show how to concatenate two arrays in your language." ) @( category, "tutorials" ) @( author, "Ken O. Burtch" ) @( see_also, "http://rosettacode.org/wiki/Array_concatenation" ); pragma license( unrestricted ); pragma software_model( nonstandard ); pragma restriction( no_external_commands ); procedure arraycat is type arrayOf3 is array(1..3) of integer; a1 : constant arrayOf3 := (1, 2, 3); a2 : constant arrayOf3 := (4, 5, 6); type arrayOf6 is array(1..6) of integer; a3 : arrayOf6; p : natural := arrays.first(a3); begin -- In SparForte, & only works on strings and there's no indefinite ranges -- or array slicing. We have to do this the hard way, one element at a -- time. for i in arrays.first(a1)..arrays.last(a1) loop a3(p) := a1(i); p := @+1; end loop; for i in arrays.first(a2)..arrays.last(a2) loop a3(p) := a2(i); p := @+1; end loop; -- show the array for i in arrays.first(a3)..arrays.last(a3) loop put( a3(i) ); end loop; new_line; end arraycat;