Liebe alle,
anbei HÜ Gruppe 1!
Viele Grüße
Katharina, Kenan, Johann
Übung1:
tmpColl = .directory ~new
tmpColl["x_index"] = "x"
tmpColl ~"[]="("y", "y_index")
tmpColl ~~PUT("z", "z_index")
tmpColl ~abc= "Alphabet"
tmpColl ~mfg="Mit freundlichen Grüßen"
SAY "Acronym 'ABC':" tmpColl~abc || ", 'MFG':" tmpColl~mfg
SAY tmpColl~string":"
DO i OVER tmpColl
SAY "["i"]"
END
Output:
REXXout>Acronym 'ABC': Alphabet, 'MFG': Mit freundlichen Grüßen
REXXout>a Directory:
REXXout>[z_index]
REXXout>[y_index]
REXXout>[MFG]
REXXout>[x_index]
REXXout>[ABC]
ÜBUNG 2:
coll_1 = .bag ~of("Apfel", "Orange", "Kirsche", "Banane")
coll_2 = .bag ~of( "Banane", "Kirsche", "Kiwi", "Zwetschke")
CALL dump coll_1~UNION(coll_2), "UNION "
CALL dump coll_1~INTERSECTION(coll_2), "INTERSECTION"
CALL dump coll_1~XOR(coll_2), "XOR "
CALL dump coll_1~DIFFERENCE(coll_2), "DIFFERENCE "
SAY coll_1~SUBSET(coll_1) "-" coll_1~SUBSET(coll_2)
::ROUTINE dump
USE ARG tmpColl, title
.output~CHAROUT( title tmpColl~string": ")
DO i OVER tmpColl
.output~CHAROUT("["i"] ")
END
.output~say
OUTPUT:
UNION a Bag: [Apfel] [Zwetschke] [Kiwi] [Kirsche] [Kirsche] [Orange] [Banane] [Banane]
INTERSECTION a Bag: [Kirsche] [Banane]
XOR a Bag: [Apfel] [Zwetschke] [Kiwi] [Orange]
DIFFERENCE a Bag: [Apfel] [Orange]
REXXout>1 - 0