(* ----------------------------------------------------------------------------
 * $Id: SACLIST.md,v 1.2 1992/02/12 17:32:02 pesch Exp $
 * ----------------------------------------------------------------------------
 * This file is part of MAS.
 * ----------------------------------------------------------------------------
 * Copyright (c) 1989 - 1992 Universitaet Passau
 * ----------------------------------------------------------------------------
 * $Log: SACLIST.md,v $
 * Revision 1.2  1992/02/12  17:32:02  pesch
 * Moved CONST definition to the right place
 *
 * Revision 1.1  1992/01/22  15:10:22  kredel
 * Initial revision
 *
 * ----------------------------------------------------------------------------
 *)

DEFINITION MODULE SACLIST;

(* SAC List Processing Definition Module. *)

 

FROM MASSTOR IMPORT LIST;

CONST rcsid = "$Id: SACLIST.md,v 1.2 1992/02/12 17:32:02 pesch Exp $";
CONST copyright = "Copyright (c) 1989 - 1992 Universitaet Passau";



PROCEDURE ADV2(L: LIST; VAR AL,BL,LP: LIST);
(*Advance 2.  L is a list of length two or more.  a=FIRST(L),
b=SECOND(L) and LP=RED(RED(L)).*)


PROCEDURE ADV3(L: LIST; VAR AL1,AL2,AL3,LP: LIST);
(*Advance 3.  L is a list of length 3 or more.  a1, a2 and a3 are
the first three elements of L.  LP is the third reductum of L.*)


PROCEDURE ADV4(L: LIST; VAR AL1,AL2,AL3,AL4,LP: LIST);
(*Advance 4.  L is a list of length 4 or more.  a1, a2, a3, and a4
are the first 4 elements of L.  LP is the fourth reductum of L.*)


PROCEDURE AREAD(): LIST;
(*Atom read.  An atom A is read from the input stream.  Any preceding
blanks are skipped.*)


PROCEDURE AWRITE(A: LIST);
(*Atom write.  The atom A is written in the output stream.*)


PROCEDURE CCONC(L1,L2: LIST): LIST;
(*Constructive concatenation.  L1 and L2 are lists.  L is the
concatenation of L1 and L2.  The list L is constructed.*)


PROCEDURE CINV(L: LIST): LIST;
(*Constructive inverse.  L is a list.  M=INV(L).  M is constructed
using comp.*)


PROCEDURE CLOUT(L: LIST);
(*Character list out.  The input is a character list L=(C(1),C(2),...,
C(n)).  The C(i) are sequentially transmitted to the output stream 
using CWRITE.*)


PROCEDURE COMP2(AL,BL,L: LIST): LIST;
(*Composition 2.  a and b are objects.  L is a list.
M=COMP(a,COMP(b,L)).*)


PROCEDURE COMP3(AL1,AL2,AL3,L: LIST): LIST;
(*Composition 3.  a1, a2 and a3 are objects.  L is a list.
M=COMP(a1,COMP(a2,COMP(a3,L))).*)


PROCEDURE COMP4(AL1,AL2,AL3,AL4,L: LIST): LIST;
(*Composition 4.  a1, a2, a3 and a4 are objects.  L is a list.
M=COMP(a1,COMP(a2,COMP(a3,COMP(a4,l)))).*)


PROCEDURE CONC(L1,L2: LIST): LIST;
(*Concatenation.  L1 and L2 are lists.  L=CONC(L1,L2).  The list L1 is
modified.*)


PROCEDURE EQUAL(AL,BL: LIST): LIST;
(*Equal.  a and b are objects.  t=1 if a and b are equal and
otherwise t=0.*)


PROCEDURE EXTENT(AL: LIST): LIST;
(*Extent.  a is an object.  n=EXTENT(a).*)


PROCEDURE FIRST2(L: LIST; VAR AL,BL: LIST);
(*First 2.  L is a list of length 2 or more.  a=FIRST(L) and
b=SECOND(L).*)


PROCEDURE FIRST3(L: LIST; VAR AL1,AL2,AL3: LIST);
(*First 3.  L is a list of length 3 or more.  a1=FIRST(L),
a2=SECOND(L) and a3=THIRD(L).*)


PROCEDURE FIRST4(L: LIST; VAR AL1,AL2,AL3,AL4: LIST);
(*First 4.  L is a list of length 4 or more.  a1=FIRST(L),
a2=SECOND(L), a3=THIRD(L) and a4=FOURTH(L).*)


PROCEDURE FOURTH(L: LIST): LIST;
(*Fourth.  L is a list of length 4 or more.  a is the fourth element
of L.*)


PROCEDURE LAST(L: LIST): LIST;
(*Last.  L is a non-null list.  LP is the location of the last cell
of L.*)


PROCEDURE LEINST(A,IL,AL: LIST): LIST;
(*List element insertion.  A is the list (a(1), ...,a(n)) of objects.
i is a beta-integer, 0 le i le n.  a is an object.  If i=0, then
L=(a,a(1), ...,a(n)).  If i=n, then L=(a(1), ...,a(n),a).
otherwise, L=(a(1), ...,a(i),a,a(i+1), ...,a(n)).  A is modified.*)


PROCEDURE LELT(A,IL: LIST): LIST;
(*List element.  A is a list.  1 le i le LENGTH(A).  a is the i-th
element of A.*)


PROCEDURE LEROT(L,IL,JL: LIST): LIST;
(*List element rotation.  L is a list (a(1), ...,a(n)) of objects, n
gt 0.  i and j, 1 le i le j le n, are beta-integers.  If i=j
then M=L.  Otherwise M=(a(1), ...,a(i-1),a(j),a(i), ...,a(j-1),
a(j+1), ...,a(n)).  L is modified.*)


PROCEDURE LINS(AL,L: LIST);
(*List insertion.  L is a non-null list (a(1), ...,a(n)).  a is an
object.  a is inserted in L after a(1) (suffixed to L if n=1),
producing a modified list L=(a(1),a,a(2), ...,a(n)).*)


PROCEDURE LINSRT(AL,A: LIST): LIST;
(*List insertion.  A is a list (a(1), ...,a(n)) of beta-integers,
n ge 0, with a(1) lt a(2) lt  ...lt a(n).  If n=0 then B=(a).
If a lt a(1) then B=(a,a(1), ...,a(n)).  If a ge a(n) then
B=(a(1), ...,a(n),a).  Otherwise B=(a(1), ...,a(i),a,a(i+1),
 ...,a(n)) where a(i) le a lt a(i+1).  The list A is modified
to produce B.*)


PROCEDURE LIST10(AL1,AL2,AL3,AL4,AL5,AL6,AL7,AL8,AL9,AL10: LIST): LIST;
(*List, 10 elements.  a1, a2, a3, a4, a5, a6, a7, a8, a9 and a10 are
objects.  L is the list (a1,a2,a3,a4,a5,a6,a7,a8,a9,a10).*)


PROCEDURE LIST2(AL,BL: LIST): LIST;
(*List, 2 elements.  a and b are objects.  L is the list (a,b).*)


PROCEDURE LIST3(AL1,AL2,AL3: LIST): LIST;
(*List, 3 elements.  a1, a2 and a3 are objects.  L=(a1,a2,a3).*)


PROCEDURE LIST4(AL1,AL2,AL3,AL4: LIST): LIST;
(*List, 4 elements.  a1, a2, a3 and a4 are objects.  L is the list
(a1,a2,a3,a4).*)


PROCEDURE LIST5(AL1,AL2,AL3,AL4,AL5: LIST): LIST;
(*List, 5 elements.  a1,a2,a3,a4 and a5 are objects.  L is the list
(a1,a2,a3,a4,a5).*)


PROCEDURE LREAD(): LIST;
(*List read.  The list L is read from the input stream.  Any preceding
blanks are skipped.*)


PROCEDURE LSRCH(AL,A: LIST): LIST;
(*List search.  A is a list of beta-integers, (a(1), ...,a(n)),
n ge 0.  If there is a j such that a=a(j) then i is the least
such j.  Otherwise i=0.*)


PROCEDURE LWRITE(L: LIST);
(*List write.  The input list L is written in the output stream.*)


PROCEDURE MEMBER(AL,L: LIST): LIST;
(*Membership test.  a is an object, L a list.  t=1 if a is a
member of L and otherwise t=0.*)


PROCEDURE ORDER(AL: LIST): LIST;
(*Order.  a is an object.  n=ORDER(a).*)


PROCEDURE OREAD(): LIST;
(*Object read.  The object B is read from the input stream.  Any
preceding blanks are skipped.*)


PROCEDURE OWRITE(B: LIST);
(*Object write.  The input object B is written in the output stream.*)


PROCEDURE PAIR(A,B: LIST): LIST;
(*Pair.  A=(a(1), ...,a(m)) and B=(b(1), ...,b(n)) are lists with
m and n non-negative.  C is the list (a(1),b(1), ...,a(r),b(r))
where r=MIN(m,n).*)


PROCEDURE REDUCT(A,IL: LIST): LIST;
(*Reductum.  A is a list.  i is a non-negative beta-integer not less
than LENGTH(A).  B=A, if i=0.  Otherwise, B is the i-th reductum of
A.*)


PROCEDURE RED2(L: LIST): LIST;
(*Reductum 2.  L is a list of length 2 or more.  LP=RED(RED(L)).*)


PROCEDURE RED3(L: LIST): LIST;
(*Reductum 3.  L is a list of length 3 or more.  M is the third
reductum of L.*)


PROCEDURE RED4(L: LIST): LIST;
(*Reductum 4.  L is a list of length 4 or more.  M is the fourth
reductum of L.*)


PROCEDURE SECOND(L: LIST): LIST;
(*Second.  L is a list of length 2 or more.  a is the second element
of L.*)


PROCEDURE SLELT(A,IL,AL: LIST);
(*Set list element.  A is a list.  1 le i le LENGTH(A).  The i-th
element of A is changed to a.*)


PROCEDURE SUFFIX(L,BL: LIST): LIST;
(*Suffix.  L is a list (a(1), ..., a(n)), n non-negative.  b is an
object.  LP=(a(1), ..., a(n),b).  L is modified.*)


PROCEDURE THIRD(L: LIST): LIST;
(*Third.  L is a list of length 3 or more.  a is the third element
of L.*)


END SACLIST.


(* -EOF- *)
