> In Aldor, we could do this by overloading. I.e., we could have something like > > SetSpecies(F: SPECIES): SPECIES > > but I guess, it does not really pay off. We should make Compose as efficient > as > possible.
Hi Martin, you have probably not meant it that way (or am I wrong?), but yes that looks quite like a solution I would like. Let us look at Compose and abbreviate macro SPECIES == (L: LabelType) -> CombinatorialSpecies L; then we have Compose: (SPECIES, SPECIES) -> SPECIES; Let us introduce the function apply: (SPECIES, SPECIES) -> SPECIES == Compose; Then if the compiler sees SetSpecies(F) it will call apply(SetSpecies, F) and thus effectively do a composition. Usually SetSpecies is of Type SPECIES. But nobody prevents us from introducing SetSpecies: SPECIES -> SPECIES; which does the obvious thing, ie, constructing E(F). If then the compiler sees SetSpecies(F) it will rather use that explicit constructor instead of invoking the "apply". In that way one can write generic code through "apply" and add specific improvements through special constructors that are independent of SetSpecies: SPECIES *and* independet of Compose/apply. The bad thing with this is that this only works since "apply" is rather special. I cannot think of something similar for example for FunctorialComposition or Times or whatever, if they allow more efficient code for particular arguments. > Of course (and this problem we also have for FunctorialComposition), some > algorithms may only be available for special arguments, for example, only for > > FunctorialComposition(SetSpecies2, SetSpecies) > > i.e., graphs > > we know how to dow generation of unlabelled structures (via nauty). A similar > problem is ranking/unranking for composition... > > I don't know how to go about this, unfortunately. Start thinking and discussing. There is always the "pseudo-solution" of doing it in an ad hoc way. But that will not work in the long run since the code must stay maintainable. So we should rather analyse what is available and how the pros and cons are in the design of other projects doing similar things. Ralf ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Aldor-combinat-devel mailing list Aldor-combinat-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aldor-combinat-devel