[Aldor-l] [Aldor-combinat-devel] Set

Ralf Hemmecke ralf at hemmecke.de
Fri Oct 6 04:54:45 EDT 2006


>>> Well, it seem that I have to implement my own SetSpecies. :-(

>> Yes. But is SetSpecies a set keeping the order of its elements? Then give  
>> it a “descriptive name”, so other people can use it as well.

That is already long enough. "Species" says quite a lot. Note that I am 
writing a literate program not just code.

> Maybe the right name would be "OrderedSet".

DEFINITELY not. What is was asking for has NOTHING to do with the order 
on the underlying type T in 'Set(T)'. T might not even export <. And I 
could want that after

a: List Integer := [3, 1, 2];
s: Set Integer := set l;
b: List Integer := s :: List(Integer);

a and b should be equal as lists. OrderedSet would make this impossible.

> In Axiom that's a category, I'm not
> sure whether it's OK to have a category and a domain having the same name. I
> believe it should be, though. I think it's quite clear that the names refer to
> different things.

Aldor allows to have category and domain called identically.

---BEGIN CatEqDom.as
#include "aldor"
define X: Category == with {}
X: X at Category == add {}
---END CatEqDom.as

>>  From my feeling, an “any instance of” should be perfectly possible with the
>> current Aldor language. Currently, you can model
>>
>>    ( l: any instance of ListType T )
>>
>> by
>>
>>    ( LT: ListType T, l: LT )
>>
>> . “any instance of” would just allow you to eliminate the first parameter.
>> It would make code more compact and more readable without losing its
>> expressivness.  (Of course we would also need an operator allowing to obtain
>> the current value of “any instance of ListType T”.)
> 
> Yes, I agree. I very often run into situations like that, and since Axiom
> doesn't support dependend types, it is even more difficult to come up with
> something proper...

It seems, that you like to write

MyPkg(LT: ListType): with {foo: LT -> Integer} == add {
     foo(l: LT): Integer == ...
}

Is that so bad?

Ralf





More information about the Aldor-l mailing list