To: J3 J3/17-131r2 From: Dan Nagle & Malcolm Cohen Date: 2017 February 16 Subject: repairs to reduce During processing of 17-115, some issues with the OPERATION argument of REDUCE were brought to subgroup's attention. This paper attempts to repair these issues. Specifically, it appears that the current description of OPERATION does not mention several restrictions that the OPERATION function must observe. To work as intended, the result of OPERATION must be a scalar to be combined with other array elements or partial results. The arguments to OPERATION must have the same attributes, since they will be different array elements of the same array, or partial results of previous application(s) of OPERATION. Since CO_REDUCE is just sitting there, language from it is appropriated and used here, with minimal changes. When doing so, subgroup noticed that the name of the function argument is "OPERATOR" in CO_REDUCE and "OPERATION" in REDUCE. Subgroup prefers OPERATOR since it is an action noun. However, this should be subject of a straw vote. The Straw Vote results are that both procedures should have the same name for the operation argument and that argument should be named "OPERATION". Edits to CO_REDUCE are included to reflect this. Edits to 17-007 [371:4-372:1-] 16.9.49 CO_REDUCE change "OPERATOR" to "OPERATION" throughout {make consistent with REDUCE} [371:17-18] Same subclause, Arguments, Change "two scalar" to "exactly two arguments; each argument shall be a scalar". After "nonoptional" change "arguments of" to "dummy data objects with". Making that sentence read "OPERATION shall be a pure function with exactly two arguments; each argument shall be a scalar, nonallocatable, nonpointer, nonpolymorphic, nonoptional dummy data object with the same type and type parameters as A." [422:18-21] the current Arguments. OPERATION text: "OPERATION shall be a pure function with two arguments of the same type and type parameters as ARRAY. Its result shall have the same type and type parameters as ARRAY. The arguments and result shall not be polymorphic. OPERATION should implement a mathematically associative operation. It need not be commutative." [422:18] change "with two arguments" to "with exactly two arguments; each argument shall be a scalar, nonallocatable, nonpointer, nonpolymorphic, nonoptional dummy data object" [422:18-19] after "as ARRAY." add a sentence "If one argument has the ASYNCHRONOUS, TARGET, or VALUE attribute, the other shall have that attribute." [422:19] change "Its result shall have" to "Its result shall be a scalar and have" The new Arguments. OPERATION text: OPERATION shall be a pure function with exactly two arguments; each argument shall be a scalar, nonallocatable, nonpointer, nonpolymorphic, nonoptional dummy data object. If one argument has the ASYNCHRONOUS, TARGET, or VALUE attribute, the other shall have that attribute. Its result shall be a scalar and have the same type and type parameters as ARRAY. The result shall not be polymorphic. OPERATION should implement a mathematically associative operation. It need not be commutative." {make OPERATION actually work}