Some time ago we started to use a library called combinat::subClass. The goal is, from a combinatorial class to get a smaller classes without writting a new domain. This is a kind of functor of combinatorial classes. Buit there are some issue:
Assume that one wants to define a combinatorial class B as a subclass of an existing combinatorial class A (for example via combinat::subClass).
The current concensus is no, no, no, yes. The problem is now to support "modular" programming!
I propose the following interface:
combinat::subClass(class, optional parameters);
the optional parameters are the following:
InheritsWithParameters = [functions to inherits with the Parse front end] Defaults to? or always include? isA, count, list, generator, unrank, random. For the moment the arguments of InheritsWithParameters are of two type
The default value is then
[["isA", 1], "count", "list", "generator", ["unrank", 1]]
I've forgotten random and probably some more... Moreover if the function does not exists in class, no error is raised. The function is simply not inherited. I'm not sure this is the right way(tm).
Permutations of S3 (class with Ax::systemRep):
p3 := combinat::subClass(combinat::permutations, Parameters = 3):
Binary Trees of size 3 (class without Ax::systemRep, the subClass has the axiom):
t3 := combinat::subClass(combinat::binaryTrees, Parameters = 3):
Vectors of lenght 3 graded by the sum (monomials in 3 variables):
vl3 := combinat::subClass(combinat::integerVectors, Parse = ((z) -> (z, 3)), Size = (z -> _plus(op(z)))):
Vectors of sum 3 graded by the lenght:
vs3 := combinat::subClass(combinat::integerVectors, Parameters = 3, Size = (z -> nops(z))):
Page Execution took real: 10.645, user: 4.530, sys: 0.700 seconds |