File: LUNION.c

package info (click to toggle)
qepcad 1.74%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,848 kB
  • sloc: ansic: 27,242; cpp: 2,995; makefile: 1,287; perl: 91
file content (27 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*===========================================================================
                              L <- LUNION(L1,L2)

List union.

Inputs
   L1,L2:  arbitrary lists.

Output
   L:  the list union of L1 and L2.
===========================================================================*/
#include "qepcad.h"

Word LUNION(Word L1, Word L2)
{
       Word L,L11,Lp1;

Step1: /* Prefix members of L1 which are not members of L2. */
       L = L2;
       Lp1 = L1;
       while (Lp1 != NIL) {
	  ADV(Lp1,&L11,&Lp1);
	  if (!MEMBER(L11,L2)) L = COMP(L11,L); }

Return: /* Prepare for return. */
       return(L);
}