I just wanted to archive some thoughts here... we would like to be able to give the user the abilitity to "use" the structures of a species he defined, possibly recursively, using other, "basic" species.
For example, having modified Times so that it exports "left: % -> F L" and "right: % -> G L" and Plus so that it exports "struct: % -> Union(left: F L, right: G L)" the following "works": A(L: LabelType): CombinatorialSpecies L with { height: % -> Integer; #if Axiom pretty: % -> OutputForm; #endif } == Plus(SingletonSpecies, Times(A, A))(L) add { Rep == Plus(SingletonSpecies, Times(A, A))(L); import from Rep; import from Union(left: SingletonSpecies(L), right: Times(A, A)(L)); import from Times(A, A)(L); height(x: %): Integer == { import from Integer; X := struct rep x; -- if X is a Singleton, the height is zero X case left => 0; -- otherwise, we have to compare the height of the left and the right branch 1+max(height left X.right, height right X.right); } #if Axiom pretty(x: %): OutputForm == { X := struct rep x; -- if X is a Singleton... X case left => (X.left)::OutputForm; -- otherwise... import from Integer, String, OutputForm, List OutputForm; vconcat [ hconcat [hspace 1, message "o"], hconcat [message "/", hspace 1, message "\"], hconcat [ pretty left X.right, hspace 3, pretty right X.right]]; } #endif }; (note that "pretty" does not *really* work, since vconcat produces a rectangular box, thus, the output looks wrong. I did not bother to fix this, but it should be doable. As an example: (19) -> pretty retract partialNext! s (19) o / \ 1 o / \ 3 o / \ o 5 / \ 2 4 Type: OutputForm (To see the difficulty, consider the subtree with labels 2 and 4. it is produced by a "pretty" invocation, which produces a box 3 rows high and 5 columns wide. Recursion then wants to print the subtree with labels 2,4 and 5, and puts this box to the left, leaves a space of 3 columns, and prints 5 on the right...) But this is maybe not the most natural way one can think of. We would like to state * what is the height of X * what is the height of Plus(A, B), given the height of A and B * what is the height of Times(A, B), given the height of A and B Two more things: * we would like to be able to produce several different functions using the recursive definition * the coercion to output should be a possible application Martin ------------------------------------------------------------------------- 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