The problem: Given two lists of e-mail addresses, report deficiencies in each list and create a combined list.
The solution:
Note: You can cut and paste these code fragments into the code pane of the Glee interpreter and experiment as you go along to see the actual operations live.
The Glee code:
$* Capture "List A" raw data removing
returns and newline chars *$
$R__$r
"A:Name 1" <name-1@addr1.com>
"A:Name 2" <name-2@addr2.com>
"A:Name 3" <name-3@addr3.com>
__ ~(13 10#asc)=> A;
$* Capture "List B" raw data removing returns and newline chars *$
$R__$r
"B:Name 2" <Name-2@Addr2.com>
"B:Name 3" <Name-3@Addr3.com>
"B:Name 4" <Name-4@Addr4.com>
__ ~(13 10#asc) => B;
$$ Extract e-mail address part and segment
"--- aa -----------------" $;
A[A *<>'<>'] %\ \|'>' => aa %**$;
"--- bb -----------------" $;
B[B *<>'<>'] %\ \|'>' => bb %**$;
$$ Show each list without the other
"--- aa ~ bb -----------"$;
aa ~ bb %**$;
"--- bb ~ aa -----------"$;
bb ~ aa %**$;
$$ Combine the lists and return unique elements
"--- aa,bb @== & ----------" $;
aa,bb @== & => cc%**$;
The Output:
--- aa -----------------
Seq[I497R1C3T:K]:
[1]String[I472R2C18:C]<name-1@addr1.com>
[2]String[I473R2C18:C]<name-2@addr2.com>
[3]String[I474R2C18:C]<name-3@addr3.com>
--- bb -----------------
Seq[I579R1C3T:K]:
[1]String[I554R2C18:C]<name-2@addr2.com>
[2]String[I555R2C18:C]<name-3@addr3.com>
[3]String[I556R2C18:C]<name-4@addr4.com>
--- aa ~ bb -----------
Seq[I618R1C1T:K]:
[1]String[I472R2C18:C]<name-1@addr1.com>
--- bb ~ aa -----------
Seq[I659R1C1T:K]:
[1]String[I556R2C18:C]<name-4@addr4.com>
--- aa,bb @== = ----------
Seq[I730R1C4T:K]:
[1]String[I472R3C18=C]<name-1@addr1.com>
[2]String[I554R3C18=C]<name-2@addr2.com>
[3]String[I555R3C18=C]<name-3@addr3.com>
[4]String[I556R3C18=C]<name-4@addr4.com>
The play-by-play:
$* Capture "List A" raw data removing
returns and newline chars *$
$R__$r
"A:Name 1" <name-1@addr1.com>
"A:Name 2" <name-2@addr2.com>
"A:Name 3" <name-3@addr3.com>
__ ~(13 10#asc)=> A;
$$ Extract e-mail address part and segment
"--- aa -----------------" $ ;
A[A *<>'<>'] %\ \|'>' => aa %**$;
$$ Show each list without the other
aa ~ bb %**$;
$$ Combine the lists and return unique elements
aa,bb @== & => cc%**$;
This completes the example. To better understand these operators and other things you can do with them, consult the operator pages according to the type of data you see being operated on..