record union(record a, record b) { record c; r_copy(c, a); r_wcall(b, r_add, 1, 2, c); return c; } record intersection(record a, record b) { record c; text s; for (s in a) { if (r_key(b, s)) { c[s] = 0; } } return c; } record difference(record a, record b) { record c; r_copy(c, a); r_vcall(b, r_resign, 1, c); return c; } integer subset(record a, record b) { integer e; text s; e = 1; for (s in a) { if (!r_key(b, s)) { e = 0; break; } } return e; } integer equal(record a, record b) { return subset(a, b) && subset(b, a); } integer main(void) { record a, b; text s; r_fit(a, "apple", 0, "cherry", 0, "grape", 0); r_fit(b, "banana", 0, "cherry", 0, "date", 0); s = "banana"; o_(" ", s, " is ", r_key(a, s) ? "" : "not ", "an element of A\n"); o_(" ", s, " is ", r_key(b, s) ? "" : "not ", "an element of B\n"); r_vcall(union(a, b), o_, 1, " "); o_newline(); r_vcall(intersection(a, b), o_, 1, " "); o_newline(); r_vcall(difference(a, b), o_, 1, " "); o_newline(); o_(" ", subset(a, b) ? "yes" : "no", "\n"); o_(" ", equal(a, b) ? "yes" : "no", "\n"); return 0; }