;N mon.cam - basic CAMILA monoidal constructions ;A J.N. Oliveira (jno@di.uminho.pt) ;D ; This small library provides two basic monoidal constructs which prove ; useful many specification contexts. ; The basic idea is to scale up monoidal computations in a compositional ; and functorial way. ; Last Update: 1999.11.11 ;E FUNC monff(m: A->B, n: A->B, f: B * B -> B): A -> B ; ; monff(m,n,f) is a higher-order function extending a binary monoidal ; operation f to the F(X)=A->X functor. ; monff(m,n,f) is itself a monoidal operator. ; RETURN m + n + [ a -> f(m[a],n[a]) | a <- dom(m) * dom(n) ]; FUNC monseq(l:B-seq,r:B-seq,f:B * B -> B):B-seq ; ; monseq(m,n,f) is a higher-order function extending a binary monoidal ; operation f to the F(X)=X-seq functor. ; monseq(m,n,f) is itself a monoidal operator. ; RETURN if l == <> then <> else if r==<> then l else < f(head(l),head(r)) > ^ monseq(tail(l),tail(r),f);