Hi Lydia:

By definition, a set can only contain one copy of each distinguishable element, 
so that answers the question about repeated elements: a semantic error would 
occur when an attempt was made to insert a duplicate element, e.g. due to 
overlapping ranges.

Whether the set is ordered or not is an implementation choice.  Iteration over 
an unordered set will produce elements in random order.  One would expect this 
behavior from an associative domain.  Iteration over an ordered set will 
produce the elements in some sorted order.  Rectangular domains are sorted, so 
in general it appears that we need to support both.

Whether iteration produces the indices in random order, the order in which they 
were inserted, or in sorted order may or may not be problematical, depending on 
the algorithm.  For example, if the elements can be processed by a coforall, 
that means order doesn't matter.  Naturally, one can (theoretically) sort the 
indices in an unordered domain before iterating over them.

THH
________________________________________
From: Lydia Duncan [[email protected]]
Sent: Monday, January 27, 2014 9:19 AM
To: [email protected]
Subject: Re: [Chapel-developers] Request for review (concept and code): Domain 
expression cleanup

Hi Tom, others:

> Therefore, not requiring the brackets would introduce a parsing ambiguity.  
> Does
>      var A : [1, 3..5, 7, 10..12] real ;
> mean a four-dimensional array containing 9 elements? or a one-dimensional 
> array containing 8 elements?
> I would choose the former and require the curly braces to force the latter 
> interpretation:
>      var A : [{1, 3..5, 7, 10..12}] real;
> (Now definitely a one-dimensional array.)
It seems like the latter interpretation would be problematic in the case
where the sets do not go in order, or where numbers are repeated.  For
instance,
     var A : [1, 7, 3..5, 10..12] real;
or
     var A: [1, 3..9, 7, 10..12] real;

Since the ranges are used as indices, how should this situation be
handled?  Should it sort the different values it obtains or alias the
index of the second slot to be 7?  Should it ignore any duplicates
values?  Should it throw an error when this situation arises?

Sorry if these are questions already addressed by sparse arrays.

-Lydia

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to