On 09/14/2016 12:58 AM, Waldek Hebisch wrote:
> Ralf Hemmecke wrote:
>>
if % is List(S) then
>>>
>>> You repeat the definition in category, I think repeat the definition
>>> in domain would be better?
>>
>> Certainly better to repeat in List domain. Logically, how would the
>> category
Ralf Hemmecke wrote:
>
> >> if % is List(S) then
> >
> > You repeat the definition in category, I think repeat the definition
> > in domain would be better?
>
> Certainly better to repeat in List domain. Logically, how would the
> category know about the actual representation of List.
>> if % is List(S) then
>
> You repeat the definition in category, I think repeat the definition
> in domain would be better?
Certainly better to repeat in List domain. Logically, how would the
category know about the actual representation of List. Furthermore,
there might be other domains
I think in this case Spad compiler can't do much about it:
It generates a SPADCALL in general cases for "rest", and
generates an inlined "CDR" for List.
So the repeat of defination is unavoidable. (See the arrays,
there's map! in OneDimensionalArrayAggregate, but those
array domains repeat the
>
> diff --git a/src/algebra/list.spad b/src/algebra/list.spad
> index 564ed16..6b73a97 100644
> --- a/src/algebra/list.spad
> +++ b/src/algebra/list.spad
> @@ -294,6 +294,12 @@
> if not member?(l11, l2) then lu := concat(l11, lu)
> l1 := rest l1
>lu
> +