From b6dd0415650fe24621a42ad676960697f77ca96c Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 26 Jun 2010 14:00:47 +0000 Subject: * algebra/aggcat.spad.pamphlet (HomogeneousAggregate): Satisfy BasicType if element type satisfies it. --- src/algebra/aggcat.spad.pamphlet | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/algebra/aggcat.spad.pamphlet') diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet index 67f5a488..1241838b 100644 --- a/src/algebra/aggcat.spad.pamphlet +++ b/src/algebra/aggcat.spad.pamphlet @@ -100,6 +100,7 @@ import Evalable ++ to be modified or updated without changing its overall value. HomogeneousAggregate(S:Type): Category == Aggregate with if S has CoercibleTo(OutputForm) then CoercibleTo(OutputForm) + if S has BasicType then BasicType if S has SetCategory then SetCategory if S has SetCategory then if S has Evalable S then Evalable S @@ -139,17 +140,22 @@ HomogeneousAggregate(S:Type): Category == Aggregate with add if S has Evalable S then eval(u:%,l:List Equation S):% == map(eval(#1,l),u) + if % has finiteAggregate then #c == # parts c any?(f, c) == or/[f x for x in parts c] every?(f, c) == and/[f x for x in parts c] count(f:S -> Boolean, c:%) == +/[1 for x in parts c | f x] members x == parts x + + if S has BasicType then + x = y == + size?(x, #y) and (and/[a = b for a in parts x for b in parts y]) + if S has SetCategory then count(s:S, x:%) == count(s = #1, x) member?(e, c) == any?(e = #1,c) - x = y == - size?(x, #y) and (and/[a = b for a in parts x for b in parts y]) + if S has CoercibleTo(OutputForm) then coerce(x:%):OutputForm == bracket -- cgit v1.2.3