-- TODO: put all this into a top-level procedure (or other compilation unit) -- There are presumably lots of little typo/compile-errors, -- since I went far far far too long w/o compiling. type Bounded_String is record chars: String(1..37); length: Natural; end record procedure put(bw:Bounded_String) is begin put(bw.chars(1..bw.length)); end -- we'll need to compare two bounded strings; we want -- ("cat_xyz..",3) = ("cat_zzz..",3) -- but the built-in/default `=` for records would compare all 37chars. -- function "="(a,b: Bounded_String) returns Boolean is begin return a.chars(1..a.length) = b.chars(1..b.length); end function get_Bounded_String return Bounded_String is result: Bounded_String; begin get_line( result.chars, result.length ); return result; end type oneThousandBoundedStrings is array(1..1000) of Bounded_String; type Word_List is record words: oneThousandBoundedStrings; length: Natural := 0; end record; procedure put(wrdz: Word_List) is begin for i in 1..wrdz.length loop put_bounded_word(wrdz(i)) end loop; end put; procedure add( wordz: Word_List; word: Bounded_String ) is begin wordz.length := wordz.length + 1; wordz.words(wordz.length) := word; end add; -- firstOccurrenceAt(i: Natural; wrd: Bounded_String; wrdz: Word_List): -- is wrdz(i)=wrd, wrdz(j) /= wrd for all 1<=j