[Aldor-l] Problem kTuple wish 2.

Ralf Hemmecke ralf at hemmecke.de
Tue Jun 26 08:19:17 EDT 2007


>>>> * certain difficulties transforming Tuples
>>> I assume your talking about the issues raised in the article I mentioned
>>> above?

> I just checked.  Although I'm still not completely sure, but I think the
> problem we have is that Tuples are *not quite* first class citizens, quite
> contrary to the recommendation of PollThompson.

Suppose you want a constructor like

M(T: Tuple Cat): MCat(T) == add {...}

for some given category Cat (For simplicity, lets say

   define Cat: Category == with {=:(%,%)->Boolean}

. The question now is how do I define MCat and the corresponding add 
{...} in such a way that I am able to generate an element of M in a 
simple form.

Basically, I want to say...

import from Integer, String, Boolean;
import from M(Integer, String);
import from M(String, String, Boolean);
a := m(4,"a");
b := m("x", "y", true);

Do you have an idea how to define the function m generically?

Also I would probably like to have

s: String := b.2;
i: Integer := a.1;
q: Boolean := b.3;

Try to define this apply function.

Important, I want to have as much type safety as possible, i.e. If I 
would have written

c := m(1, "x", false);

the compiler should already shout that the type of the first argument 
doesn't fit.

Good luck.

Ralf



More information about the Aldor-l mailing list