Boolean Objects and Operations

I've collected examples for Simple Boolean Objects and Operations (Scalars, Vectors, and Indexing) on a single page because they are so simple.

Simple Boolean Scalars and Vectors

I have combined boolean scalar and vector examples. By now you know there is no difference between a scalar and a vector in Glee.

Commentary Code Result
Commentary "0101" & "0011"$;
"0101" | "0011"$;
"0101" ^ "0011"$;
"0101" ~&"0011"$;
"0101" ~|"0011"$;
0001
0111
0110
1110
1000
Commentary #false => f; f ~& f $; 1
Commentary #true => t; t & t $; 1
Commentary #true & #true $; Not Supported

Simple Boolean Indexing

Boolean indexing is not likely to be commonly used. Typically one makes relational tests on some domain (e.g. ID's, Account Numbers, Amount values, etc.). One then compounds these tests by logical operations into some boolean selection vector. This selection vector then becomes the index into objects of interest. In APL you had the additional step of selecting indices with the selection vector and then using the indices for indexing. This step was really unnecessary so in Glee I have eliminated it.

Code Result
Commentary 1 0 1 1 0*=1["10111"]$;
1 0 1 1 0*=1[1 3 4 5]$;
1 0 1 1 0*=1[_1 0 1 2 3 4 5 6]$;
1 0 1 1 0*=1[.1 1.1 2.1 3.1 4.1 5.1]$;
1110
1110
11101100
110110
Commentary 10` => a $;
(a *> 2)&(a *<8) $;
a[(a *> 2)&(a *< 8)] $;
1 2 3 4 5 6 7 8 9 10
00111110 00
3 4 5 6 7
Commentary 10 30 20 60 30 => ID $;
100 300 200 600 333=> Amt $;
ID *| (30 60 90) => Sel $;
ID[Sel] $;
Amt[Sel] $;
10 30 20 60 30
100 300 200 600 333
01011
30 60 30
300 600 333
Commentary '<1a>--'$;1 0 1 *= 1 ` $;
'<1b>--'$;1 0 1 *= 1 `` $;
'<2>--'$;5 %% 5 ?100 =>n$;
'<3>--'$;n *> 2=>b$;
'<4>--'$;b``$;
'<5>--'$;n[b``]$;
'<6>--'$;n[b]$;
<1a>--
1
<1b>--
1 3
<2>--
1 5 1 4 5
<3>--
01011
<4>--
2 4 5
<5>--
5 4 5
<6>--
5 4 5