Discussion:
multisort
Martin Rubey
2007-06-11 18:57:06 UTC
Permalink
A new (experimental) version of multisort species. Open to discussion.

I tried an approach somewhat inspired by the Object example in the AUG. I also
checked whether I can use this approach for Plus, Times and Composition, and
found that it will work without any trouble. (For Composition, we would need
to introduce another "Object" type, of the form Record(S: MSPECIES M, m: S).)

I cannot remember, unfortunately, what we said about this approach during our
meeting end of April. Shame on me.

Martin


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Ralf Hemmecke
2007-06-12 08:09:27 UTC
Permalink
Dear Martin,

a short note on your branches/multisort-experiment/src/mspecies.as.nw (r205)

line 230:-------------------------------
\begin{+++}
\adthisname{} generates structures where for the labels of some sorts are
considered as being indistinguishable. The indices of these sorts
are given
as a second argument.
\end{+++}
%CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
<<exports: MultisortSpecies>>=
structures: (Multiset M, List I) -> Generator %;
@
-----------------------------------------

I have no idea, what you mean by "indices of these sorts".

line 239:-------------------------------
\begin{+++}
\adthisname{} generates the isomorphism types of the species, i.e., the
labels of each variable are considered as indistinguishable.
\end{+++}
%CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
<<exports: MultisortSpecies>>=
isomorphismTypes: (Multiset M) -> Generator %;
@
-----------------------------------------

I don't understand what "labels of each variable" means. In particular I
don't understand "variable" here.

line 239:-------------------------------
\adthistype{} stores a species together with its LabelType. Apart
from being
convenient, it seems to be \emph{necessary}, because \xAldor{}
doesn't seem
to like constructs like
\begin{adsnippet}
List Record(L: LabelType, SetSpecies L)
\end{adsnippet}
-----------------------------------------

That is not a good description of the problem with Aldor. I have to
invent code and test this myself rather than just reading about the
particular problem you had. That is wasted time for people who want to
understand your need for this "Wrapped" design decision.

line 321:-------------------------------
<<representation: Multiset>>=
Rep == List Wrapped SetSpecies; import from Rep;
@
-----------------------------------------

Is there a particular reason why you have chosen "List" instead of "Array"?

line 564:-------------------------------
<<implementation: MultiSubset>>=
structures(s: Multiset M, i: I, l: List I): Generator % == generate {
aux(L: LabelType, s: SetSpecies L): Generator Wrapped Subset ==
generate {
for a in (
if member?(i, l)$List(I)
then isomorphismTypes(s)$Subset(L)
else structures(s)$Subset(L);
) repeat {
yield object(L, a)$Wrapped(Subset)
}
}
if (prev i = #$%) then yield per [];
else {
import from Wrapped SetSpecies;
for a in aux avail(s.i) repeat {
for p in structures(s, next i, l) repeat {
yield per cons(a, rep p);
}
}
}
}

structures(s: Multiset M, l: List I): Generator % == structures(s, 1, l);
@
-----------------------------------------

I dont understand the first function. In particular, it is unclear why
there appears something like

if member?(i, l)$List(I)
then isomorphismTypes(s)$Subset(L)
else structures(s)$Subset(L);

in "structures". You probably have your reasons, but unfortunately you
don't give your knowledge to others.


line 689:-------------------------------
Given a partition $1^2 5 | 1 6 | 4 6^2$ we recover the elements by replacing
numbers from left to right: $1 2 b | 3 r | a s t$.
-----------------------------------------

Although you haven't written it somewhere, you also take the point of
view of "iso-types = representatives". That's good.
But your replacement only works in this case but not for general
structures. But maybe it is enough. I'll have to invest more time in
Knuth's algorithm.




Although I don't like this "Wrapped" thing too much, I found your code
surprisingly good. I still need more time to digest, but if we can
completely hide "Wrapped" inside Multiset (at the moment you still seem
to have need for

<<implementation: Multiset>>=
apply(x: %, i: I): Wrapped SetSpecies == (rep x).i;
@

where "Wrapped" is seen by the outside world) then this approach is
certainly worth to be considered.

The remaining discussion we can do at the workshop.

Ralf

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Christian Aistleitner
2007-06-13 06:07:20 UTC
Permalink
Hello Martin,

On Mon, 11 Jun 2007 20:57:06 +0200, Martin Rubey
Post by Martin Rubey
I cannot remember, unfortunately, what we said about this approach during our
meeting end of April. Shame on me.
I'm sorry. Since it is some time off and I haven't been dealing with the
topic of species since our meeting, it's too long ago for me to remember
the details :(

Kind regards,
Christian

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Continue reading on narkive:
Loading...