[sv-ec] Reduction method on empty array

From: Steven Sharp <sharp_at_.....>
Date: Tue Oct 27 2009 - 10:48:43 PDT
Some dynamic array types can be empty (have no elements).  What should be
the result of an array reduction method applied to such an array?

Possible answers:

1. The "identity" value for the operation (e.g. 0 for sum, but 1 for product).
This would be the most natural degenerate value.  The result for an N-element
array is the same as combining the Nth element with the result for an
(N-1)-element array.  Using the identity value for 0 would ensure that this
remained true for N=1 also.

2. The "default" or "out-of-range" value for the element type (or type of
the 'with' expression, if any).  This would be natural if this is considered
an "out-of-range" situation.  As a slight alternative, it could be the result
of initializing the accumulation with the array[0] element.  This would be
the same as the "out-of-range" value unless a 'with' clause was used that
evaluated to a different value.

3. This could be a run-time error.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Oct 27 10:51:01 2009

This archive was generated by hypermail 2.1.8 : Tue Oct 27 2009 - 10:51:55 PDT