seq.cam - a CAMILA library for the A-seq functor
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
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,f,l)
is the standard catamorphism on finite sequences
seqInseg(n)
is the sequence version of inseg(n).
Thus elems(seqInseg(n))
== inseg(n).
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)
inserts a as a separator in l.
For instance, seqAddSep(<c,d,a>,a) == <c,a,d,a,a>.
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)
is l in reverse order.
Thus elems(seqInv(l))
== elems(l)
and
seqInv(seqInv(l))
== l are valid properties of seqInv.
seqBlast(l)
keeps all elements of l but the last one.
seq2mseSeq(l)
converts l into the corresponding sequence of unitary
multisets, which may be useful in a data-mining context.
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,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,r)
computes the subsequence of l which does not contain any
element of r.
So, elems(seqDiff(s,r))
== elems(s)
- elems(r).
No include commands found.
J.N. Oliveira (jno@di.uminho.pt)