NAME

seq.cam - a CAMILA library for the A-seq functor


SYNOPSYS

 seqCata(c:B,f:AxB->B,l:A-seq):B
 seqInseg(n:NAT):NAT-seq
 seqSubl(l:A-seq,i:NAT,n:NAT0):A-seq
 seqAddSep(l:A-seq,a:A):A-seq
 seq2mset(l:A-seq):A->NAT
 seqInv(l:A-seq):A-seq
 seqBlast(l:A-seq):A-seq
 seq2mseSeq(l:A-seq):(A->NAT)-seq
 set2seq(s:A-set):A-seq
 seq2ff(l:A-seq):NAT->A
 seqSplit(l:A-seq,n:NAT):(A-seq)-seq
 seqDiff(s:A-seq,r:A-seq):A-seq
 seqUpdate(x:A,d:B,l:A-seq):A-seq


DESCRIPTION

This library adds extra functionality to the CAMILA built-in

polymorphic finite sequence data type F(X)=X-seq.

Last Update: 1999.11.11

The informal semantics of the operators are as follows:

seqCata(c:B,f:AxB->B,l:A-seq):B
seqCata(c,f,l) is the standard catamorphism on finite sequences

seqInseg(n:NAT):NAT-seq
seqInseg(n) is the sequence version of inseg(n). Thus elems(seqInseg(n)) == inseg(n).

seqSubl(l:A-seq,i:NAT,n:NAT0):A-seq
seqSubl(l,i,n) selects from l its n-element-long subsequence, from the ith position onwards, or as much as possible if l is too short.

seqAddSep(l:A-seq,a:A):A-seq
seqAddSep(l,a) inserts a as a separator in l. For instance, seqAddSep(<c,d,a>,a) == <c,a,d,a,a>.

seq2mset(l:A-seq):A->NAT
seq2mset(l) converts l into the multiset of its elements. So, order is lost but not multiplicity. Thus facts dom(seq2mset(l)) == elems(l) and mseSumRan(seq2mset(l)) == length(l) hold.

seqInv(l:A-seq):A-seq
seqInv(l) is l in reverse order. Thus elems(seqInv(l)) == elems(l) and seqInv(seqInv(l)) == l are valid properties of seqInv.

seqBlast(l:A-seq):A-seq
seqBlast(l) keeps all elements of l but the last one.

seq2mseSeq(l:A-seq):(A->NAT)-seq
seq2mseSeq(l) converts l into the corresponding sequence of unitary multisets, which may be useful in a data-mining context.

set2seq(s:A-set):A-seq
The ``inverse'' of elems...

seq2ff(l:A-seq):NAT->A
seq2ff(l) converts sequence l into a finite mapping keeping track of the original element positions. Thus properties dom(seq2ff(l))==inseg(length(l)) and seq2ff(l)[i]== l(i) hold.

seqSplit(l:A-seq,n:NAT):(A-seq)-seq
seqSplit(l,n) partitions l into the sequence of its subsequences of fixed length n (except possibly the last). Therefore, CONC(seqSplit(l,n)) == l holds.

seqDiff(s:A-seq,r:A-seq):A-seq
seqDiff(s,r) computes the subsequence of l which does not contain any element of r. So, elems(seqDiff(s,r)) == elems(s) - elems(r).

seqUpdate(x:A,d:B,l:A-seq):A-seq
seqUpdate forces every x to d in l


SEE ALSO

No include commands found.


AUTHOR

J.N. Oliveira (jno@di.uminho.pt)