-- This example changes "+" to "*" from the previous example -- -- The test procedure that instantiates GENSUMPKG with -- generic actual parameters FLOAT and MY_ARRAY and "*" -- -- The third generic formal parameter was the default in the -- previous two examples. ( This is useful in sorting where -- ">" can be changed to "<" to reverse the order of the sort ) -- with TEXT_IO ; use TEXT_IO ; with GENSUMPKG ; procedure TEST_GENSUMPKG is type MY_ARRAY is array ( INTEGER range <> ) of FLOAT ; STUFF : MY_ARRAY ( 1 .. 3 ) := ( 1.0 , 2.0 , 3.0 ) ; package FLT_IO is new FLOAT_IO ( FLOAT ) ; use FLT_IO ; -- This is the generic instantiation of the package above package MY_SUM is new GENSUMPKG ( ELEMENT => FLOAT , KEY_1 => MY_ARRAY , "+" => "*" ) ; -- changed --or package MY_SUM is new GENSUMPKG ( FLOAT , MY_ARRAY , "*" ) ; use MY_SUM ; -- optional, could also write MY_SUM.SUM below begin PUT_LINE ( " GENERIC SUM PACKAGE " ) ; SUM ( STUFF ) ; -- call procedure in instantiated package PUT ( STUFF( 1 )) ; PUT_LINE ( " = SUM " ) ; end TEST_GENSUMPKG ; GENERIC SUM PACKAGE \__ This is actually the product. The titles were 6.00000E+00 = SUM / not changed. ( 1+2+3 happens to equal 1*2*3 )