diff options
author | dos-reis <gdr@axiomatics.org> | 2010-04-17 23:03:55 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-04-17 23:03:55 +0000 |
commit | 5b24e39b978891b7a8dc22b9ab6ffa5eec341e6a (patch) | |
tree | 450e549494784c805ce24f0b319598a7e25cb0e8 /src/algebra/prtition.spad.pamphlet | |
parent | 423125f1638b432ccfb944f954fd4304ddfb0183 (diff) | |
download | open-axiom-5b24e39b978891b7a8dc22b9ab6ffa5eec341e6a.tar.gz |
* algebra/prtition.spad.pamphlet (powers$Partition): Return list
of pairs.
Diffstat (limited to 'src/algebra/prtition.spad.pamphlet')
-rw-r--r-- | src/algebra/prtition.spad.pamphlet | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/algebra/prtition.spad.pamphlet b/src/algebra/prtition.spad.pamphlet index a340ef4d..4f19e1f8 100644 --- a/src/algebra/prtition.spad.pamphlet +++ b/src/algebra/prtition.spad.pamphlet @@ -40,12 +40,10 @@ Partition(): Exports == Implementation where ConvertibleTo List Integer,CoercibleTo List Integer) with partition: L I -> % ++ partition(li) converts a list of integers li to a partition - powers: L I -> L L I - ++ powers(li) returns a list of 2-element lists. For each 2-element - ++ list, the first element is an entry of li and the second - ++ element is the multiplicity with which the first element - ++ occurs in li. There is a 2-element list for each value - ++ occurring in l. + powers: L I -> List Pair(I,PositiveInteger) + ++ powers(li) returns a list of pairs. The second component of + ++ each pair is the multiplicity with which the first component + ++ occurs in li. pdct: % -> I ++ \spad{pdct(a1**n1 a2**n2 ...)} returns ++ \spad{n1! * a1**n1 * n2! * a2**n2 * ...}. @@ -91,7 +89,7 @@ Partition(): Exports == Implementation where powers l == empty? l => nil li := bite(first l,rest l) - cons([first l,first(li) + 1],powers(rest li)) + cons(pair(first l,first(li)::PositiveInteger + 1),powers(rest li)) conjugate x == per conjugate(rep x)$PartitionsAndPermutations @@ -99,8 +97,8 @@ Partition(): Exports == Implementation where i2 = 1 => (i1 :: OUT) ** (" " :: OUT) (i1 :: OUT) ** (i2 :: OUT) - mkexp1(lli: L L I): L OUT == - empty? lli => nil() + mkexp1(lli: L Pair(I,PositiveInteger)): L OUT == + empty? lli => nil li := first lli empty?(rest lli) and second(li) = 1 => [first(li) :: OUT] |