seq.cam - a CAMILA library for the A-seq functor
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
seq2ff(l:A-seq):NAT->A
seqSplit(l:A-seq,n:NAT):(A-seq)-seq
This library adds extra functionality to the CAMILA built-in
polymorphic finite sequence data type F(X)=X-seq.
The informal semantics of the operators are as follows:
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.
No include commands found.
J.N. Oliveira (jno@di.uminho.pt)