|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2214 (0x8a6)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with Text_Io;
use Text_Io;
package body Sets is
type Bool is array (Element) of Boolean;
function "and" (Left, Right : Set) return Set is
begin
return Set (Bool (Left) and Bool (Right));
end "and";
function "or" (Left, Right : Set) return Set is
begin
return Set (Bool (Left) or Bool (Right));
end "or";
function "xor" (Left, Right : Set) return Set is
begin
return Set (Bool (Left) xor Bool (Right));
end "xor";
function "not" (Right : Set) return Set is
begin
return Set (not Bool (Right));
end "not";
function "-" (Left, Right : Set) return Set is
begin
return (Left and not Right);
end "-";
function "+" (Left : Element; Right : Set) return Set is
Temp : Set := Right;
begin
Temp (Left) := True;
return Temp;
end "+";
function "+" (Left : Set; Right : Element) return Set is
Temp : Set := Left;
begin
Temp (Right) := True;
return Temp;
end "+";
function "+" (Right : Element) return Set is
begin
return Empty_Set + Right;
end "+";
function "+" (Left, Right : Element) return Set is
begin
return Empty_Set + Left + Right;
end "+";
function "-" (Left : Set; Right : Element) return Set is
Temp : Set := Left;
begin
Temp (Right) := False;
return Temp;
end "-";
function "<=" (Left, Right : Set) return Boolean is
begin
return ((Left and not Right) = Empty_Set);
end "<=";
function Is_Member (S : Set; E : Element) return Boolean is
begin
return (S (E) = True);
end Is_Member;
procedure Put (S : Set) is
Comma_Needed : Boolean := False;
begin
Text_Io.Put ("{");
for E in Element loop
if S (E) then
if Comma_Needed then
Text_Io.Put (",");
end if;
Text_Io.Put (Image (E));
Comma_Needed := True;
end if;
end loop;
Text_Io.Put ("}");
New_Line;
end Put;
end Sets;
-- This procedure tests the set package.
-- Its output is self-explanatory.