Index: doc/theses/jiada_liang_MMath/test.adb
===================================================================
--- doc/theses/jiada_liang_MMath/test.adb	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.adb	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,102 @@
+with Ada.Text_IO; use Ada.Text_IO;
+-- with Ada.Standard; use Ada.Standard;
+procedure test is
+	type RGB is ( Red, Green, Blue );
+	for RGB use ( Red => 10, Green => 20, Blue => 30 );
+	Colour : RGB := Red;
+	
+	type ABC is ('A', 'B', 'C');
+	Chars : ABC := 'C';
+	
+	type Operator is ( '+', '-', '*', '/' );
+	for Operator use ( '+' => 10, '-' => 20, '*' => 30, '/' => 40 );
+	op : Operator := '+';
+	Ops : array( 0..3) of Operator;
+	
+	type Week is ( Mon, Tue, Wed, Thu, Fri, Sat, Sun );
+	for Week use ( Mon => 0, Tue => 1, Wed => 2, Thu => 10, Fri => 11, Sat => 14, Sun => 15 );
+	subtype Weekday is Week range Mon .. Fri;
+	subtype Weekend is Week range Sat .. Sun;
+	Day : Week;
+	Lunch : array( Week ) of Integer;
+	
+--   type Boolean is ( False, True );
+	B : Boolean := True;
+begin
+	Put_Line( Integer'Image( RGB'Pos( Colour ) ) & " " & RGB'Image( RGB'Val(0) ) );
+	Put_Line( Integer'Image( RGB'Enum_Rep( Colour ) ) & " " & RGB'Image( RGB'Enum_Val( 10 ) ) );
+	Put_Line( """" & RGB'Image( Colour ) & """ " & RGB'Image( RGB'Value( "Red" ) ) );
+
+	
+	Put_Line( RGB'Image( Colour ) & Integer'Image( RGB'Pos( Colour ) ) & Integer'Image( RGB'Enum_Rep( Colour ) ) );
+	Put_Line( RGB'Image( Colour ) & Integer'Image( RGB'Pos( Colour ) ) & Integer'Image( RGB'Enum_Rep( Colour ) ) );
+	
+	for op in RGB loop
+		Put( "(" & Integer'Image( RGB'Pos( op ) ) & Integer'Image( RGB'Enum_Rep( op ) ) & ' ' & RGB'Image( op ) & ") " );
+	end loop;
+	Put_Line( "" );
+
+	Put_Line( ABC'Image( Chars ) );
+	Put_Line( Integer'Image( ABC'Pos( Chars ) ) );
+	
+	Op := '+';
+	if Op = '+' or else Op = '-' then null;
+	elsif Op = '*' or else Op = '/' then null; end if;
+	
+	case Op is
+		when '+' => null;
+		when '-' => null;
+		when '*' => null;
+--      when '/' => null;
+		when others => null;
+	end case;
+	for op in Operator loop
+		Put( "(" & Integer'Image( Operator'Pos( op ) ) & Integer'Image( Operator'Enum_Rep( op ) ) & ' ' & Operator'Image( op ) & ") " );
+	end loop;
+	Put_Line( "" );
+	
+	Ops := "+-*/";
+	Ops := "+-" & "*/";
+	for Op of Ops loop
+		Put_Line( Operator'Image( Op ) );
+	end loop;
+	Day := Wed;
+	case Day is
+		when Mon .. Fri => null;
+		when Sat .. Sun => null;
+	end case;
+	case Day is
+		when Weekday => null;
+		when Weekend => null;
+	end case;
+	for Day in Mon .. Sun loop
+		Put( Week'Image( Day ) & " " );
+	end loop;
+	Put_Line( "" );
+	for Day in Week loop
+		Put( Week'Image( Day ) & " " );
+	end loop;
+	Put_Line( "" );
+	for Day in Weekday loop
+		Put( Week'Image( Day ) & " " );
+	end loop;
+	Put_Line( "" );
+	for Day in Weekend loop
+		Put( Week'Image( Day ) & " " );
+	end loop;
+	Put_Line( "" );
+	
+	for Day in Week loop
+		Lunch( Day ) := 3;
+	end loop;
+	for Day in Week loop
+		Put( Integer'Image( Lunch(Day ) ) & " " );
+	end loop;
+	
+	if B then null; end if;
+end test;
+
+-- Local Variables: --
+-- tab-width: 4 --
+-- compile-command: "gnatmake test.adb" --
+-- End: --
Index: doc/theses/jiada_liang_MMath/test.c
===================================================================
--- doc/theses/jiada_liang_MMath/test.c	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.c	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,72 @@
+#include <stdio.h>
+#include <stdlib.h>
+//#include <fstream.hfa>
+
+enum color { red, blue, green };
+//enum color c1 = 0;
+//enum color c2 = 1;
+enum color c3 = 2;
+int c = red;
+
+static const int one = 0 + 1;
+static const void * NIL = NULL;
+static const double PI = 3.14159;
+static const char Plus = '+';
+static const char * Fred = "Fred";
+static const int Mon = 0, Tue = Mon + 1, Wed = Tue + 1, Thu = Wed + 1, Fri = Thu + 1,
+					Sat = Fri + 1, Sun = Sat + 1;
+
+void foo() {
+	const int r = random() % 100;
+	int va[r];
+}
+
+struct Person { char * name; int age, height; };
+
+//enum E { A, B, C };
+
+enum { X = 10, Y = 9, Z = -5 };
+enum { A, B, C = 10, D, E = 10 };
+
+enum { Size = 20, Max = 10, MaxPlus10 = Max + 10, Max10PlusOne };
+
+//enum( Person ) friends { Liz = { "ELIZABETH", 22, 170 }, Beth = Liz,
+//						 Jon = { "JONATHAN", 35, 190 } };
+
+void www( int p ) {}
+
+int main() {
+	printf( "%d\n", Size );
+	struct /* unnamed */ { int i; } x, y, z;
+	x.i = 3;
+	www( x.i );
+
+	struct S {
+		union /* unnamed */ { // unscoped fields
+			int i; double d ; char ch;
+		};
+	};
+
+	struct S s;
+	s.i = 3;
+	s.d = 3.5;
+
+	const int r = random();
+	int sa[Sun];
+
+	enum Week { Mon, Tue, Wed, Thu = 10, Fri, Sat, Sun };
+	enum Week week;
+	switch ( week ) {
+	  case Mon: case Tue: case Wed: case Thu: case Fri:
+		printf( "weekday\n" );
+	  case Sat: case Sun:
+		printf( "weekedn\n" );
+	}
+	for ( enum Week day = Mon; day <= Sun; day = (enum Week)(day + 1) ) {
+	}
+
+	// int jane_pos = posnE( Mon );
+	// char * jane_value = valueE( Jane );
+	// char * jane_label = labelE( Names.Jane );
+	// sout | labelE( Names.Jane ) | valueE( Names.Jane );
+}
Index: doc/theses/jiada_liang_MMath/test.cc
===================================================================
--- doc/theses/jiada_liang_MMath/test.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,80 @@
+#include <iostream>
+#include <cstdlib>
+#include <variant>
+using namespace std;
+
+// struct S { char s[32]; };
+// variant< int, double, S > vd;
+// variant< int, int, int > vs;
+
+// int main() {
+// 	cout << "sizeof vd " << sizeof( vd ) << endl;
+// 	vd = 3;
+// 	if ( holds_alternative<int>(vd) ) cout << "int " << get<int>(vd ) << endl;
+// 	vd = 3.5;
+// 	if ( holds_alternative<double>(vd) ) cout << "double " << get<double>(vd) << endl;
+// 	vd = (S){ "abc" };
+// 	if ( holds_alternative<S>(vd) ) cout << "S.s " << get<S>(vd).s << endl;
+
+// 	cout << "sizeof vs " << sizeof( vs ) << endl;
+// 	vs = (variant<int,int,int>){ in_place_index<0>, 12 };
+// 	if ( vs.index() == 0 ) cout << "posn 0 " << get<0>(vs) << endl;
+// 	vs = (variant<int,int,int>){ in_place_index<1>, 4 };
+// 	if ( vs.index() == 1 ) cout << "posn 1 " << get<1>(vs) << endl;
+// 	vs = (variant<int,int,int>){ in_place_index<2>, 5 };
+// 	if ( vs.index() == 2 ) cout << "posn 2 " << get<2>(vs) << endl;
+// }
+
+constexpr auto one = 0 + 1;
+const auto NUL = nullptr;
+const auto PI = 3.14159;
+const auto Plus = '+';
+const auto Fred = "Fred";
+const auto Mon = 0, Tue = Mon + 1, Wed = Tue + 1, Thu = Wed + 1, Fri = Thu + 1, Sat = Fri + 1, Sun = Sat + 1;
+const auto r = random();
+
+enum E { A, B, C };
+enum class EC : long { A, B, C };
+
+int a1[Sun + 1], a2[C + 1];
+
+int main() {
+	const auto one = random();
+//	const int * ip = &one;
+	int sa[Sun];
+	int * i = NUL;
+	E e;
+	// switch ( e ) {
+	//   case w: ;
+	// }
+	switch ( e ) {
+	  case Sat: ;
+	}
+	switch ( e ) {
+	  case C: ;
+	}
+	EC ec;
+	switch ( ec ) {
+	  case EC::A: ;
+	}
+	EC eca[C];
+	eca[A] = EC::A;
+
+	enum Week { Mon, Tue, Wed, Thu = 10, Fri, Sat, Sun };
+	Week day = Mon;
+	if ( day <= Fri ) cout << "weekday" << endl;
+	switch ( day ) {
+	  case Mon: case Tue: case Wed: case Thu: case Fri:
+		cout << "weekday" << endl; break;
+	  case Sat: case Sun:
+		cout << "weekend" << endl; break;
+	}
+	for ( Week d = Mon; d <= Sun; d = (Week)(d + 1) ) {
+		cout << d << ' ';
+	}
+	cout << endl;
+}
+
+// Local Variables: //
+// compile-command: "g++ -std=c++17 test.cc" //
+// End: //
Index: doc/theses/jiada_liang_MMath/test.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/test.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,57 @@
+enum Alphabet {
+	A = 'A', B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
+	a = 'a', b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
+};
+
+
+forall( istype & | istream( istype ) | { istype & ?|?( istype &, E & ); } )
+istype & ?|?( istype & is, E & e ) {
+	choose ( e ) {
+	  case A: is | label( A ); e = A;
+	  case B: is | label( B ); e = B;
+	  case C: is | label( C ); e = C;
+	} // choose
+	return is;
+}
+
+forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, E ); } )
+	ostype & ?|?( ostype & os, E e ) {
+	choose ( e ) {
+	  case A: os | label( A );
+	  case B: os | label( B );
+	  case C: os | label( C );
+	} // choose
+	return os;
+}
+
+enum( char * ) Friends { Fred = "FRED", Mary = "MARY", Jane = "Jane" };
+
+forall( istype & | istream( istype ) | { istype & ?|?( istype &, Friends & ); } )
+istype & ?|?( istype & is, Friends & friend ) {
+	choose ( friend ) {
+	  case Fred: is | label( A ); friend = A;
+	  case Mary: is | label( B ); friend = B;
+	  case Jane: is | label( C ); friend = C;
+	} // choose
+	return is;
+}
+
+forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, Friends ); } )
+	ostype & ?|?( ostype & os, Friends friend ) {
+	choose ( friend ) {
+	  case Fred: os | value( Fred );
+	  case Mary: os | value( Mary );
+	  case Jane: os | value( Jane );
+	} // choose
+	return os;
+}
+
+
+int main() {
+	E e = A;
+	sin | e;
+	sout | e;
+	Friends friend = Mary;
+	sin | friend;
+	sout | friend;
+}
Index: doc/theses/jiada_liang_MMath/test.go
===================================================================
--- doc/theses/jiada_liang_MMath/test.go	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.go	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,59 @@
+package main
+import "fmt"
+
+// const R int = 0;
+// const G uint = 1;
+// const B = 2;
+// const Fred = "Fred";
+// const Mary = "Mary";
+// const Jane = "Jane";
+// const S = 0;
+// const T = 0;
+// const USA = "USA";
+// const U = "USA";
+// const V = 3.1;
+// const W = 3.1;
+// 
+// func main() {
+//      fmt.Println( Mon, Tue, Wed )
+// } // main
+
+
+const ( R = 0; G = 3; B ) // implicit: 0 0 0
+const ( Fred = "Fred"; Mary = "Mary"; Jane = "Jane" ) // Fred Mary Jane
+const ( H = 0; Jack = "Jack"; J; K = 0; I ) // type change, implicit: 0 Jack Jack
+const ( C = iota + G; M = iota; Y )
+const ( Mon = iota; Tue; Wed; // 0, 1, 2
+	Thu = 10; Fri = iota - Wed + Thu - 1; Sat; Sun = iota ) // 10, 11, 12, 13
+const ( O1 = iota + 1; _; O3; _; O5 ) // 1, 3, 5
+const ( V1 = iota; V2; V3 = 7; V4 = iota + 1; V5 )
+const ( S = 0; T; USA = "USA"; U; V = 3.1; W )
+const ( D = 1.5; E );
+
+
+
+func main() {
+	if 3 == R {};
+	fmt.Println( R, G, B )
+	fmt.Println( Fred, Mary, Jane )
+	fmt.Println( H, Jack, J, K, I )
+	fmt.Println( C, M, Y )
+	fmt.Println( Mon, Tue, Wed, Thu, Fri, Sat, Sun )
+	fmt.Println( O1, O3, O5 )
+	fmt.Println( V1, V2, V3, V4, V5 )
+	fmt.Println( S, T, USA, U, V, W )
+
+	day := Mon;
+	switch day {
+	  case Mon, Tue, Wed, Thu, Fri:
+		fmt.Println( "weekday" );
+	  case Sat, Sun:
+		fmt.Println( "weekend" );
+	}
+	for i := Mon; i <= Sun; i += 1 {
+	    fmt.Println( i )
+	}
+
+	var ar[Sun] int
+	ar[Mon] = 3
+} // main
Index: doc/theses/jiada_liang_MMath/test.hs
===================================================================
--- doc/theses/jiada_liang_MMath/test.hs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.hs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,39 @@
+data S = S { i::Int, d::Double }
+data Foo = A Int | B Double | C S
+
+foo = A 3;
+bar = B 3.5
+baz = C S{ i = 7, d = 7.5 }
+
+prtfoo val =
+  -- pattern match on constructor
+  case val of
+    A a -> print a
+    B b -> print b
+    C (S i d) -> do
+        print i
+        print d
+
+data Bar = X Int | Y Int | Z Int;
+prtbar val =
+  -- pattern match on constructor
+  case val of
+    X x -> print x
+    Y y -> print y
+    Z z -> print z
+
+foo2 = X 3;
+bar2 = Y 4;
+baz2 = Z 5;
+
+main = do
+  prtfoo foo
+  prtfoo bar
+  prtfoo baz
+  prtbar foo2
+  prtbar bar2
+  prtbar baz2
+
+-- Local Variables: --
+-- compile-command: "ghc test.hs; ./test" --
+-- End: --
Index: doc/theses/jiada_liang_MMath/test.java
===================================================================
--- doc/theses/jiada_liang_MMath/test.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,77 @@
+import java.io.*;
+
+public class test {
+	enum Week {
+		Mon, Tue, Wed, Thu, Fri, Sat, Sun;
+		public boolean isWeekday() { return ordinal() <= Fri.ordinal(); }
+		public boolean isWeekend() { return Fri.ordinal() < ordinal(); }
+	}
+	
+
+	// object oriented definition
+	enum Week2 {
+		//	    Mon, Tue, Wed, Thu, Fri, Sat, Sun;
+		Mon(1), Tue(2), Wed(3), Thu(4), Fri(5), Sat(6), Sun(7); // must appear first
+		public long day;
+		private Week2( long d ) { day = d; }
+
+		public boolean isWeek() {
+			return ordinal() <= Week2.Fri.ordinal();
+		}
+		public boolean isWeekend() {
+			return Week2.Fri.ordinal() < ordinal();
+		}
+	}
+
+	public static void main( String[] args ) {
+		// non-object oriented usage
+		Week day = Week.Sat;
+		
+		day = Week.valueOf( "Sat" );
+		System.out.println( day.ordinal() + " " + day + " " + day.name() ); // 5 Sat
+		System.out.println( day.isWeekday() );  // false
+		System.out.println( day.isWeekend() );  // true
+
+		if ( day == Week.Fri )
+			System.out.println( "weekday" );
+		switch ( day ) {
+		  case Mon: case Tue: case Wed: case Thu: case Fri:
+			System.out.println( "weekday" );
+			break;
+		  case Sat: case Sun:
+			System.out.println( "weekend" );
+			break;
+		}
+		for ( Week d : Week.values() ) {
+			System.out.print( d + " " + d.ordinal() + " " );
+		}
+		System.out.println(); System.out.println();
+
+		// object oriented usage
+		Week2 cday = Week2.Sat;
+		cday.day += 42;
+		System.out.println( cday.ordinal() + " " + cday.day + " " +  cday.name() );
+
+		System.out.println( cday.isWeek() );  // false
+		System.out.println( cday.isWeekend() );  // true
+
+		switch ( cday ) {
+		  case Mon: case Tue: case Wed: case Thu: case Fri:
+			System.out.println( "weekday" );
+			break;
+		  case Sat: case Sun:
+			System.out.println( "weekend" );
+			break;
+		}
+		for ( Week2 icday : Week2.values() ) {
+			System.out.print( icday.ordinal() + " " + icday.day + " " +  icday.name() + ",  " );
+		}
+		System.out.println();
+
+		int intArray[];
+		intArray = new int[20];
+		intArray[Week.Fri] = 3;
+	}
+}
+
+// java test
Index: doc/theses/jiada_liang_MMath/test.ml
===================================================================
--- doc/theses/jiada_liang_MMath/test.ml	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.ml	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,49 @@
+type s = { i :  int; }
+type fred = I of int | D of float | S of s
+type mary = I of int | D of int | S of int
+type weekday = Mon | Tue | Wed | Thu | Fri | Sat | Sun
+let day : weekday = Mon
+let take_class( d : weekday ) =
+	if d <= Fri then				(* Gregor *)
+		Printf.printf "weekday\n"
+	else if d >= Sat then			(* Gregor *)
+		Printf.printf "weekend\n";
+	match d with
+		Mon | Wed -> Printf.printf "CS442\n" |
+		Tue | Thu -> Printf.printf "CS343\n" |
+		Fri -> Printf.printf "Tutorial\n" |
+		_ -> Printf.printf "Take a break\n"
+
+let _ = take_class( Mon ); take_class( Sat );
+
+type colour = Red | Green of string | Blue of int * float
+let c = Red
+let _ = match c with Red -> Printf.printf "Red, "
+let c = Green( "abc" )
+let _ = match c with Green g -> Printf.printf "%s, " g
+let c = Blue( 1, 1.5 )
+let _ = match c with Blue( i, f ) -> Printf.printf "%d %g\n" i f
+
+let check_colour(c: colour): string =
+	if c < Green( "xyz" ) then		(* Gregor *)
+		Printf.printf "green\n";
+	match c with
+		Red -> "Red" |
+		Green g -> g |
+		Blue(i, f) -> string_of_int i ^ string_of_float f
+let _ = check_colour( Red ); check_colour( Green( "xyz" ) );
+
+type stringList = Empty | Pair of string * stringList
+let rec len_of_string_list(l: stringList): int =
+	match l with
+		Empty -> 0 |
+		Pair(_ , r) -> 1 + len_of_string_list r
+
+let _ = for i = 1 to 10 do
+	Printf.printf "%d, " i
+done
+
+(* Local Variables: *)
+(* tab-width: 4 *)
+(* compile-command: "ocaml test.ml" *)
+(* End: *)
Index: doc/theses/jiada_liang_MMath/test.py
===================================================================
--- doc/theses/jiada_liang_MMath/test.py	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.py	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,219 @@
+import random
+from enum import Enum, unique, auto, IntEnum, IntFlag, Flag
+from datetime import date
+from itertools import islice
+
+class OrderedEnum(Enum):
+	def __ge__(self, other):
+		if self.__class__ is other.__class__:
+			return self.value >= other.value
+		return NotImplemented
+	def __gt__(self, other):
+		if self.__class__ is other.__class__:
+			return self.value > other.value
+		return NotImplemented
+	def __le__(self, other):
+		if self.__class__ is other.__class__:
+			return self.value <= other.value
+		return NotImplemented
+	def __lt__(self, other):
+		if self.__class__ is other.__class__:
+			return self.value < other.value
+		return NotImplemented
+
+#class Week(Enum):
+#	Mon = 1; Tue = 2; Wed = 3; Thu = 10; Fri = 10; Sat = 16; Sun = 17
+class Week(OrderedEnum):
+	Mon = 1; Tue = 2; Wed = 3; Thu = 4; Fri = 5; Sat = 6; Sun = 7
+	def isWeekday(self):
+		return Week(self.value) <= Week.Fri
+	def isWeekend(self):
+		return Week.Fri < Week(self.value) 
+	@classmethod
+	def today(cls, date):
+		return cls(date.isoweekday())
+
+day : Week = Week.Tue;
+print( "weekday:", day.isWeekday() )
+print( "weekend:", day.isWeekend() )
+print( "today:", Week.today(date.today()))
+
+print( Week.Thu.value == 4 );
+print( Week.Thu.name == "Thu" );
+print( Week( 4 ) == Week.Thu );
+print( Week["Thu"].value == 4 );
+
+if day <= Week.Fri :
+	print( "weekday" );
+match day:
+	case Week.Mon | Week.Tue | Week.Wed | Week.Thu | Week.Fri:
+		print( "weekday" );
+	case Week.Sat | Week.Sun:
+		print( "weekend" );
+
+for day in Week:
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+for day in islice(Week,0,5):
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+for day in islice(Week,5,7):
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+for day in islice(Week,0,7,2):
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+
+class WeekD(Enum): Mon = 1; Tue = 2; Wed = 3; Thu = 10; Fri = 10; Sat = 10; Sun = 10
+for day in WeekD:
+	print( "Dup", day.name, ":", day.value, end=" " )
+print( "" )
+for day in WeekD.__members__:
+	print( "Dup", day, ":", end=" " )
+print( "" )
+
+print( Week["Sat"] )
+print( Week( 3 ) )
+print( Week["Thu"] )
+print( str( Week.Thu ), Week.Thu )
+print( Week.Thu.name, Week.Thu.value )
+print( isinstance(Week.Fri, Week) )
+
+class WeekE(OrderedEnum): pass;
+class WeekDay(WeekE): Mon = 1; Tue = 2; Wed = 3; Thu = 4; Fri = 5;
+class WeekEnd(WeekE): Sat = 6; Sun = 7
+print( "inheritance" )
+print( type(WeekE) )
+dayI : WeekE = WeekDay.Fri
+print( type(dayI), dayI )
+dayI = WeekEnd.Sat
+print( type(dayI), dayI )
+
+for day in WeekE:
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+for day in WeekDay:
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+for day in WeekEnd:
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+
+class Week2(Enum): Mon = 1; Tue = 2; Wed = 3; Thu = 10; Fri = auto(); Sat = 4; Sun = auto()
+for day in Week2:
+	print( day.name, ":", day.value, end=" " )
+print( "" )
+
+#@unique
+#class DupVal(Enum): ONE = 1; TWO = 2; THREE = 3; FOUR = 3
+
+class RGB(Enum): Red = 1; Green = 2; Blue = 3
+for c in RGB:
+	print( c.name, ":", c.value )
+
+day = RGB.Red
+print( "X", day )
+day : Week = RGB.Red
+print( "X", day )
+
+class WeekF(Flag): Mon = 1; Tue = 2; Wed = 4; Thu = auto(); Fri = 16; Sat = 32; Sun = 64; \
+      Weekday = Mon | Tue | Wed | Thu | Fri; \
+      Weekend = Sat | Sun
+print( f"0x{repr(WeekF.Weekday.value)} 0x{repr(WeekF.Weekend.value)}" )
+day : WeekF = WeekF.Mon | WeekF.Tue;
+print( type(day) )
+for day in WeekF:
+	print( f"WeekF {day.name}: {day.value}", end=" " )
+print( "" )
+weekday = WeekF.Weekday
+for day in WeekF.Mon:
+	print( f"WeekF.Mon {day.name}:"
+           f" {day.value}", end=" " )
+print( "" )
+for day in weekday:
+	print( f"weekday {day.name}:"
+           f" {day.value}", end=" " )
+print( "" )
+weekend = WeekF.Weekend
+for day in weekend:
+	print( f"weekend {day.name}:"
+           f" {day.value}", end=" " )
+print( "" )
+
+class WeekA(Flag): Mon = auto(); Tue = auto(); Wed = auto(); Thu = auto(); Fri = auto();  \
+							Sat = auto(); Sun = auto(); Weekend = Sat | Sun
+for d in WeekA:
+	print( f"{d.name}: {d.value}", end=" ")
+print( "" )
+print(WeekA.Weekend)
+
+class RGBa(Enum): RED = auto(); BLUE = auto(); GREEN = auto()
+for c in RGBa:
+	print( f"{c.name} {c.value}" )
+print( RGBa(1), RGBa(3) )
+print( RGBa["RED"], RGBa["GREEN"] )
+member = RGBa.RED
+print( f"{member.name} {member.value}" )
+
+class Shape(Enum): SQUARE = 2; DIAMOND = 1; CIRCLE = 3; ALIAS_FOR_SQUARE = 2
+print(Shape.SQUARE)
+
+print( "" )
+class Diff(Enum): Int = 1; Float = 3.5; Str = "ABC"
+diffval : Diff = Diff.Int
+match diffval:
+	case Diff.Int:
+		print( "diffval", diffval.value );
+	case Diff.Float:
+		print( "diffval", diffval.value );
+	case Diff.Str:
+		print( "diffval", diffval.value );
+for i in Diff:
+	print( f"Diff type {type(i)}, {i}, {i.name}, {i.value} : " )
+print( "\n" )
+
+def by_position(enum_type, position):
+	for index, value in enumerate(enum_type):
+		if position == index: return value
+	raise Exception("by_position out of range")
+
+class Planet(Enum):
+	#		   mass (kg)  radius (km)
+	MERCURY = ( 0.330E24, 2.4397E6 )
+	VENUS   = ( 4.869E24, 6.0518E6 )
+	EARTH   = ( 5.976E24, 6.3781E6 )
+	MOON	= ( 7.346E22, 1.7380E6 ) # not a planet
+	MARS	= ( 0.642E24, 3.3972E6 )
+	JUPITER = ( 1898.E24, 71.492E6 )
+	SATURN  = ( 568.8E24, 60.268E6 )
+	URANUS  = ( 86.86E24, 25.559E6 )
+	NEPTUNE = ( 102.4E24, 24.746E6 )
+	def __init__(self, mass, radius):
+		self.mass = mass		# in kilograms
+		self.radius = radius	# in meters
+	def surfaceGravity(self):
+		# universal gravitational constant  (m3 kg-1 s-2)
+		G = 6.67300E-11
+		return G * self.mass / (self.radius * self.radius)
+	def surfaceWeight(self, otherMass):
+		return otherMass * self.surfaceGravity();
+
+earthWeight : float = 100
+earthMass : float = earthWeight / ( Planet.EARTH.surfaceGravity() );
+
+p = by_position( Planet, random.randrange(8) ) # select a random orbiting body
+match p:
+	case Planet.MERCURY | Planet.VENUS | Planet.EARTH | Planet.MARS:
+		print( f"{p.name} is a rocky planet" )
+	case Planet.JUPITER | Planet.SATURN | Planet.URANUS | Planet.NEPTUNE:
+		print( f"{p.name} is a gas-giant planet" )
+	case _:
+		print( f"{p.name} is not a planet" )
+
+for p in Planet:
+	print( f"Your weight on {p.name} is {p.surfaceWeight(earthMass):1.1f} kg" )
+
+# Local Variables: #
+# tab-width: 4 #
+# compile-command: "python3.13 test.py" #
+# End: #
Index: doc/theses/jiada_liang_MMath/test.rs
===================================================================
--- doc/theses/jiada_liang_MMath/test.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,116 @@
+use std::mem;
+
+enum WeekO { Mon, Tue, Wed, Thu, Fri, Sat, Sun }
+#[derive(Debug, Clone, Copy)]
+enum Week { Mon, Tue, Wed = 2, Thu = 10, Fri, Sat, Sun }
+
+#[derive(Debug)]
+struct S {
+	i : isize, j : isize,
+}
+#[repr(u8)]
+#[derive(Debug)]
+enum ADT {
+	I(isize) = 5,
+	F(f64) = 10,
+	S(S) = 0,
+}
+
+#[derive(Debug)]
+enum Animal {
+	Dog( String, f64 ),
+	Cat{ name: String, weight: f64 },
+}
+
+#[derive(Debug)]
+enum Direction { North, South, East, West }
+
+impl Direction {
+    const VALUES: [Self; 4] = [Self::North, Self::South, Self::East, Self::West];
+}
+#[repr(u8)]
+enum Fieldless {
+    Tuple() = 5,
+    Struct{} = 10,
+    Unit = 12,
+}
+impl Fieldless {
+    fn discriminant(&self) -> u8 {
+        // SAFETY: Because `Self` is marked `repr(u8)`, its layout is a `repr(C)` `union`
+        // between `repr(C)` structs, each of which has the `u8` discriminant as its first
+        // field, so we can read the discriminant without offsetting the pointer.
+        unsafe { *<*const _>::from(self).cast::<u8>() }
+    }
+}
+fn main() {
+	let arr : [i32; 7];
+
+	let mut s = S{ i : 3, j : 4 };
+	let mut adt : ADT;
+	adt = ADT::I(3);  println!( "{:?}", adt );
+	adt = ADT::F(3.5);  println!( "{:?}", adt );
+	adt = ADT::S(s);  println!( "{:?}", adt );
+	match adt {
+		ADT::I(i) => println!( "{:}", i ),
+		ADT::F(f) => println!( "{:}", f ),
+		ADT::S(s) => println!( "{:} {:}", s.i, s.j ),
+	}
+
+	let mut wo : WeekO = WeekO::Mon;
+	match wo {
+		WeekO::Mon => println!( "Mon" ),
+		_ => (),
+	}
+	
+	let mut fl : Fieldless;
+	fl = Fieldless::Struct{};
+	match fl {
+		Fieldless::Struct{} => println!( "Struct" ),
+		_ => (),
+	}
+	if fl.discriminant() == 10 {
+		println!( "Struct" );
+	}
+	let mut week: Week = Week::Sat;
+	match week {
+		Week::Mon => println!( "X {:?}", Week::Mon as isize ),
+		Week::Tue => println!( "X {:?}", Week::Tue as isize ),
+		Week::Wed => println!( "X {:?}", Week::Wed as isize ),
+		Week::Thu => println!( "X {:?}", Week::Thu as isize ),
+		Week::Fri => println!( "X {:?}", Week::Fri as isize ),
+		Week::Sat => println!( "X {:?}", Week::Sat as isize ),
+		Week::Sun => println!( "X {:?}", Week::Sun as isize ),
+	}
+	match week {
+		Week::Mon | Week:: Tue | Week::Wed | Week::Thu | Week::Fri => println!( "weekday" ),
+		Week::Sat | Week:: Sun => println!( "weekend" ),
+	}
+	println!( "{:?} {:?}", week as isize, Week::Fri as isize );
+	if mem::discriminant(&week) == mem::discriminant(&Week::Mon) {
+		println!( "{:?}", week );
+	}
+	if week as isize == Week::Mon as isize {
+		println!( "{:?}", week );
+	}
+	for d in Week::Mon as isize ..= Week::Sun as isize {
+		print!( "{:?} ", d );
+	}
+	println!( "" );
+	let mut mon : isize = Week::Mon as isize;
+
+	week = Week::Fri;
+	println!( "{:?}", week );
+
+	let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2);
+	println!( "{:?}", a );
+	a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 };
+//	println!( "{:?} {:?}", a, a.name );
+
+ 	for direction in Direction::VALUES {
+        println!("{direction:?}");
+    }
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: doc/theses/jiada_liang_MMath/test.swift
===================================================================
--- doc/theses/jiada_liang_MMath/test.swift	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test.swift	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,88 @@
+struct S {
+	var i : Int,  j : Int
+}
+var s = S( i : 3, j : 5 )
+enum ADT {
+	case I(Int)   // int
+	case F(Float) // float
+	case S(S)     // struct
+}
+var adt : ADT
+adt = ADT.I( 3 );  print( adt )
+adt = .F( 3.5 );  print( adt )
+adt = .S( s );  print( adt )
+switch adt {
+	case .I(let i):  print( i )
+	case .F(let f):  print( f )
+	case .S(let s):  print( s.i, s.j )
+}
+
+enum Week: Comparable {
+	case Mon, Tue, Wed, Thu, Fri, Sat, Sun // unit-type
+	func isWeekday() -> Bool { return self <= .Fri }  // method
+	func isWeekend() -> Bool { return .Sat <= self }  // method
+};
+var week : Week = Week.Mon;
+
+if week == .Mon {
+	print( week );
+}
+if week <= .Fri {
+	print( "weekday" );
+}
+if .Sat < week {
+	print( "weekend" );
+}
+switch week { // exhaustive
+	case .Mon: print( "Mon" )
+	case .Tue: print( "Tue" )
+	case .Wed: print( "Wed" )
+	case .Thu: print( "Thu" )
+	case .Fri: print( "Fri" )
+	case .Sat: print( "Sat" )
+	case .Sun: print( "Sun" )
+}
+
+enum WeekI: Comparable, CaseIterable {
+	case Mon, Tue, Wed, Thu, Fri, Sat, Sun // unit-type
+};
+var weeki : WeekI = WeekI.Mon;
+if weeki <= .Fri {
+	print( "weekday" );
+}
+for day in WeekI.allCases { 
+	print( day, terminator:" " ) 
+}
+print( "" )
+
+print( WeekI.allCases.count, WeekI.allCases )
+
+enum WeekInt: Int, CaseIterable {
+	case Mon, Tue, Wed, Thu = 10, Fri,
+			Sat = 4, Sun // auto-incrementing
+};
+var weekInt : WeekInt = WeekInt.Mon;
+print( WeekInt.Thu.rawValue );
+for day in WeekInt.allCases {
+	print( day.rawValue, terminator:" " ) 
+}
+print( "" )
+
+enum WeekStr: String, CaseIterable {
+	case Mon = "MON", Tue, Wed, Thu, Fri,
+			Sat = "SAT", Sun
+};
+for day in WeekStr.allCases { 
+	print( day.rawValue, terminator:" " ) 
+}
+print( "" )
+
+if let opt = WeekInt( rawValue: 0 ) {
+	print( weekInt.rawValue, opt )
+} else {
+	print( "invalid weekday lookup" )
+}
+
+// Local Variables: //
+// compile-command: "swift test.swift" //
+// End: //
Index: doc/theses/jiada_liang_MMath/test1.c
===================================================================
--- doc/theses/jiada_liang_MMath/test1.c	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.c	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,10 @@
+#include <stdio.h>
+const enum E { A = 42 };
+enum E e = A;
+enum(double) D { A = 42.5 };
+enum D d = A;
+int main() {
+	int i = e;
+	double j = d;
+	printf( "%d %d %g %g\n", e, i, d, j );
+}
Index: doc/theses/jiada_liang_MMath/test1.cc
===================================================================
--- doc/theses/jiada_liang_MMath/test1.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,35 @@
+#include <iostream>
+using namespace std;
+void fred() {
+}
+
+int main() {
+	enum class E { A, B, C };
+	enum W { K, J, L };
+	char www[L];
+	int i;
+//	i = E::A; i = K;
+	E e;
+//	e = 42;
+	enum class CCC : char { A = 'a', B, C };
+	CCC c;
+//	char ch = E::A;
+//	c = 'z';
+	enum class RGB : long { Red, Green, Blue };
+	enum class rgb : char { Red = 'r', Green = 'g', Blue = 'b' };
+	enum class srgb : signed char { Red = -1, Green = 0, Blue = 1 };
+	RGB colour1 = RGB::Red;
+	rgb colour2 = rgb::Red;
+	srgb colour3 = srgb::Red;
+//	int s = E::A + E::A;
+	if ( rgb::Red == rgb::Blue ) cout << "FRED" << endl;
+	if ( rgb::Red == rgb::Green ) cout << "FRED0" << endl;
+	if ( rgb::Red == rgb::Red ) cout << "FRED1" << endl;
+	cout << (int)rgb::Red << endl;
+	switch ( colour2 ) {
+	  case rgb::Red: ;
+	  case rgb::Green: ;
+	  case rgb::Blue: ;
+	}
+	for ( int i = rgb::Red; i < rgb::Blue; i += 1 ) {}
+}
Index: doc/theses/jiada_liang_MMath/test1.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/test1.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,90 @@
+#include <fstream.hfa>									// sout
+#include <stdlib.hfa>									// ato
+
+// integral
+enum Letter {
+	A = 'A', B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
+	a = 'a', b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
+};
+enum( Letter ) Greek { Alph = A, Beta = B, Gamma = G, /* more enums */ Zeta = Z }; // alphabet intersection
+
+enum( char ) Currency { Dollar = '$', Cent = '¢', Yen = '¥', Pound = '£', Euro = 'E' }; // iso-latin-1
+enum( Currency ) Europe { Euro = Currency.Euro, Pound = Currency.Pound };
+
+enum( signed char ) srgb { Red = -1, Green = 0, Blue = 1 };
+enum( long long int ) BigNum { X = 123_456_789_012_345,  Y = 345_012_789_456_123 };
+// non-integral
+enum( double ) Math { PI_2 = 1.570796, PI = 3.141597, E = 2.718282 };
+enum( _Complex ) Plane { X = 1.5+3.4i, Y = 7+3i, Z = 0+0.5i };
+// pointer
+enum( const char * ) Name { Fred = "FRED", Mary = "MARY", Jane = "JANE" };
+int i, j, k;
+enum( int * ) ptr { I = &i,  J = &j,  K = &k };
+//enum( int & ) ref { I = i,   J = j,   K = k };
+// tuple
+//enum( [int, int] ) { T = [ 1, 2 ] };
+// function
+void f() {}   void g() {}
+enum( void (*)() ) funs { F = f,  G = g };
+// aggregate
+struct Person { char * name; int age, height; };
+enum( Person ) friends { Liz = { "ELIZABETH", 22, 170 }, //Beth = Liz,
+						 Jon = { "Jonathan", 35, 190 } };
+
+enum() Mode { O_RDONLY, O_WRONLY, O_CREAT, O_TRUNC, O_APPEND };
+Mode iomode = O_RDONLY;
+bool b = iomode == O_RDONLY || iomode < O_APPEND;
+int www = iomode;
+
+enum( char * ) Colour { Red = "red", Green = "green", Blue = "blue"  };
+
+void fred() {
+Letter letter = A;
+Greek greek = Beta;
+letter = Beta;							// allowed, letter == B
+//greek = A;								// disallowed
+
+	for ( Greek l = Alph; posE(l) <= posE(Gamma); l = succ( l ) ) {
+		printf( "%s %c %d\n", labelE( l ), valueE( l ), posE( l ) );
+	}
+	for ( Currency c = Dollar; posE(c) <= posE(Currency.Euro); c = succ( c ) ) {
+		printf( "%s %c %d\n", labelE( c ), valueE( c ), posE( c ) );
+	}
+}
+
+
+enum( char * ) Names { Fred = "FRED", Mary = "MARY", Jane = "JANE" };
+enum( char * ) Names2 { inline Names, Jack = "JACK", Jill = "JILL" };
+enum( char * ) Names3 { inline Names2, Sue = "SUE", Tom = "TOM" };
+
+void f( Names n ) { sout | "Name" | posE( n ); }
+void g( Names2 );
+void h( Names3 );
+void j( char * );
+
+enum color { red, blue, green };
+//color c = 0;
+//color c = 1;
+color c = 2;
+int w = red;
+
+// enum(int) Week ! { Mon, Tue, Wed, Thu = 10, Fri, Sat, Sun };
+// enum(int) RGB ! { Red, Green, Blue };
+
+// void foo() {
+// 	with ( Week, RGB ) {
+// 		weekday = Sun;
+// 		rgb = Green;
+// 	}
+// }
+
+int main() {
+	fred();
+	Names name = Fred;
+//	f( name );
+
+	int jane_pos = posE( Names.Jane );
+	char * jane_value = valueE( Names.Jane );
+	char * jane_label = labelE( Names.Jane );
+	sout | Names.Jane | posE( Names.Jane) | labelE( Names.Jane ) | valueE( Names.Jane );
+}
Index: doc/theses/jiada_liang_MMath/test1.hs
===================================================================
--- doc/theses/jiada_liang_MMath/test1.hs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.hs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,15 @@
+data Week = Mon | Tue | Wed | Thu | Fri | Sat | Sun deriving(Eq, Enum, Show)
+
+day = Tue
+main = do
+  if day == Tue then
+     print day
+  else
+     putStr "not Tue"
+  print (enumFrom Mon) -- week
+  print (enumFromTo Mon Fri) -- weekday
+  print (enumFromTo Sat Sun) -- weekend
+
+-- Local Variables: --
+-- compile-command: "ghc test1.hs; ./test1" --
+-- End: --
Index: doc/theses/jiada_liang_MMath/test1.java
===================================================================
--- doc/theses/jiada_liang_MMath/test1.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,35 @@
+import java.io.*;
+
+public class test1 {
+	enum Weekday {
+		Mon(7), Tue(6), Wed(5), Thu(3), Fri(3), Sat(3), Sun(1); // must appear first
+		private long day;
+		private Weekday( long d ) { day = d; }
+	}
+
+	public static void main( String[] args ) {
+		Weekday cday = Weekday.Sat;
+		System.out.println( cday.ordinal() + " " + cday + " " +  cday.name() ); // label
+
+		if ( cday == Weekday.Fri ) { // position
+			System.out.println( "true" );
+		}
+		// if ( cday < Weekday.Sat ) { // no releation operations
+		// 	System.out.println( "true" );
+		// }
+		switch ( cday ) { // position
+		  case Mon: case Tue: case Wed: case Thu: case Fri:
+			System.out.println( "weekday" );
+			break;
+		  case Sat: case Sun:
+			System.out.println( "weekend" );
+			break;
+		}
+		for ( Weekday icday : Weekday.values() ) { // position
+			System.out.print( icday + " " + icday.ordinal() + " " + icday.day + " " +  icday.name() + ",  " ); // label
+		}
+		System.out.println();
+	}
+}
+
+// java test1
Index: doc/theses/jiada_liang_MMath/test1.ml
===================================================================
--- doc/theses/jiada_liang_MMath/test1.ml	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.ml	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,28 @@
+type character_class =
+    Barbarian
+  | Bard
+  | Cleric
+  | Druid
+  | Fighter
+  | Monk
+  | Paladin
+  | Ranger
+  | Rogue
+  | Sorcerer
+  | Wizard
+
+type rectitude = Evil | R_Neutral | Good
+
+type firmness = Chaotic | F_Neutral | Lawful
+
+let rectitude_to_french = function
+    | Evil -> "Mauvais"
+    | R_Neutral -> "Neutre"
+    | Good -> "Bon"
+
+let X : string = rectitude_to_french( Evil );
+
+(* Local Variables: *)
+(* tab-width: 4 *)
+(* compile-command: "ocaml test1.ml" *)
+(* End: *)
Index: doc/theses/jiada_liang_MMath/test1.rs
===================================================================
--- doc/theses/jiada_liang_MMath/test1.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test1.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,33 @@
+use std::mem;
+
+#[repr(u8)] enum Fieldless {
+    Tuple() = 5,
+    Struct{} = 10,
+    Unit = 12,
+}
+impl Fieldless {
+    fn discriminant(&self) -> u8 {
+        // SAFETY: Because `Self` is marked `repr(u8)`, its layout is a `repr(C)` `union`
+        // between `repr(C)` structs, each of which has the `u8` discriminant as its first
+        // field, so we can read the discriminant without offsetting the pointer.
+        unsafe { *<*const _>::from(self).cast::<u8>() }
+    }
+}
+fn main() {
+	let mut fl : Fieldless;
+	fl = Fieldless::Struct{};
+	match fl {
+		Fieldless::Struct{} => println!( "Struct" ),
+		_ => (),
+	}
+	if mem::discriminant(&fl) == mem::discriminant(&Fieldless::Struct{}) {
+		println!( "Struct" );
+	}
+	if fl.discriminant() == 10 {
+		println!( "Struct" );
+	}
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: doc/theses/jiada_liang_MMath/test2.cc
===================================================================
--- doc/theses/jiada_liang_MMath/test2.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test2.cc	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,8 @@
+struct unit {};
+void foo( void );
+unit bar( unit );
+int main() {
+	unit u;
+	foo( foo() );
+	bar( bar( u ) );
+}
Index: doc/theses/jiada_liang_MMath/test2.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/test2.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test2.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,51 @@
+#include <fstream.hfa>
+#include <stdlib.hfa>
+
+struct MR { double mass, radius; };
+
+enum( MR ) Planet {
+	//          mass (kg)  radius (km)
+	MERCURY = { 0.330_E24, 2.4397_E6 },
+	VENUS   = { 4.869_E24, 6.0518_E6 },
+	EARTH   = { 5.976_E24, 6.3781_E6 },
+	MOON    = { 7.346_E22, 1.7380_E6 }, // not a planet
+	MARS    = { 0.642_E24, 3.3972_E6 },
+	JUPITER = { 1898._E24, 71.492_E6 },
+	SATURN  = { 568.8_E24, 60.268_E6 },
+	URANUS  = { 86.86_E24, 25.559_E6 },
+	NEPTUNE = { 102.4_E24, 24.746_E6 },
+};
+
+enum( double ) { G = 6.6743_E-11 }; // universal gravitational constant (m3 kg-1 s-2)
+
+static double surfaceGravity( Planet p ) with( p ) {
+	return G * mass / ( radius \ 2 ); // exponentiation
+}
+static double surfaceWeight( Planet p, double otherMass ) {
+	return otherMass * surfaceGravity( p );
+}
+
+int main( int argc, char * argv[] ) {
+	if ( argc != 2 ) exit | "Usage: " | argv[0] | "earth-weight";
+
+	double earthWeight = convert( argv[1] );
+	double earthMass = earthWeight / surfaceGravity( EARTH );
+
+	Planet p = fromInt( prng( SizeE(Planet) ) ); // select a random orbiting body
+//	Planet p = fromInt( prng( 9 ) ); // select a random orbiting body
+	choose( p ) {
+	  case MERCURY, VENUS, EARTH, MARS:
+		sout | labelE( p ) | "is a rocky planet";
+	  case JUPITER, SATURN, URANUS, NEPTUNE:
+		sout | labelE( p ) | "is a gas-giant planet";
+	  default:
+		sout | labelE( p ) | "is not a planet";
+	}
+
+//	for ( Planet p = MERCURY; posE(p) <= posE(NEPTUNE); p = succ( p ) ) {
+	for ( p; enum Planet ) {
+		sout | "Your weight on" | (p == MOON ? "the" : "") | labelE(p)
+//		sout | "Your weight on" | labelE(p)
+			 | "is" | wd( 1,1, surfaceWeight( p, earthMass ) ) | "kg";
+	}
+}
Index: doc/theses/jiada_liang_MMath/test2.rs
===================================================================
--- doc/theses/jiada_liang_MMath/test2.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test2.rs	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,22 @@
+use std::mem;
+
+#[derive(Debug, Clone, Copy)]
+enum Week { Mon, Tues, Wed = 2, Thu = 10, Fri, Sat = 5, Sun }
+
+fn main() {
+	let mut week: Week = Week::Mon;
+	println!( "{:?} {:?}", week as isize, Week::Fri as isize );
+	if mem::discriminant(&week) == mem::discriminant(&Week::Mon) {
+		println!( "{:?}", week );
+	}
+	if week as isize == Week::Mon as isize {
+		println!( "{:?}", week );
+	}
+	for n in Week::Mon as isize .. Week::Fri as isize {
+		println!( "{:?}", n );
+	}
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: doc/theses/jiada_liang_MMath/test20.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/test20.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test20.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,10 @@
+int main() {
+//	enum { X = 3, Y = 3.5 };
+//	enum(char *) { Z = "abc" };
+	enum { X = 3, Y = 3.5, Z = "abc" };
+
+	int i = X;
+	double d = Y;
+	printf( "%g\n", d );
+	const char * str = Z;
+}
Index: doc/theses/jiada_liang_MMath/test3.cfa
===================================================================
--- doc/theses/jiada_liang_MMath/test3.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/test3.cfa	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,8 @@
+enum Week ! { Mon, Tue, Wed, Thu = 10, Fri, Sat, Sun };
+enum RGB ! { Red, Green, Blue };
+void foo() {
+	Week week = Week.Mon;
+	week = Week.Sat;
+	RGB rgb = RGB.Red;
+	rgb = RGB.Blue;
+}
Index: doc/theses/jiada_liang_MMath/testP1.java
===================================================================
--- doc/theses/jiada_liang_MMath/testP1.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/testP1.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,47 @@
+import java.io.*;
+
+public class testP1 {
+    public enum Planet {
+		//          mass      radius
+		MERCURY ( 3.303E23, 2.4397E6 ),
+		VENUS   ( 4.869E24, 6.0518E6 ),
+		EARTH   ( 5.976E24, 6.37814E6 ),
+		MARS    ( 6.421E23, 3.3972E6 ),
+		JUPITER ( 1.9E27,   7.1492E7 ),
+		SATURN  ( 5.688E26, 6.0268E7 ),
+		URANUS  ( 8.686E25, 2.5559E7 ),
+		NEPTUNE ( 1.024E26, 2.4746E7 );
+
+		private final double mass;   // in kilograms
+		private final double radius; // in meters
+
+		Planet( double mass, double radius ) {
+			this.mass = mass;
+			this.radius = radius;
+		}
+		private double mass() { return mass; }
+		private double radius() { return radius; }
+
+		// universal gravitational constant  (m3 kg-1 s-2)
+		public static final double G = 6.67300E-11;
+
+		double surfaceGravity() {
+			return G * mass / ( radius * radius );
+		}
+		double surfaceWeight( double otherMass ) {
+			return otherMass * surfaceGravity();
+		}
+    }
+    public static void main( String[] args ) {
+		if ( args.length != 1 ) {
+			System.err.println( "Usage: java Planet <earth_weight>" );
+			System.exit( -1 );
+		}
+		double earthWeight = Double.parseDouble( args[0] );
+		double mass = earthWeight / Planet.EARTH.surfaceGravity();
+		for ( Planet p : Planet.values() )
+			System.out.printf( "Your weight on %s is %f%n", p, p.surfaceWeight( mass ) );
+    }
+}
+
+// java test
Index: doc/theses/jiada_liang_MMath/testP2.java
===================================================================
--- doc/theses/jiada_liang_MMath/testP2.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/testP2.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,46 @@
+import java.io.*;
+
+public class testP2 {
+	public enum Planet {
+		//          mass      radius
+		MERCURY ( 3.303e+23, 2.4397e6 ),
+		VENUS   ( 4.869e+24, 6.0518e6 ),
+		EARTH   ( 5.976e+24, 6.37814e6 ),
+		MARS    ( 6.421e+23, 3.3972e6 ),
+		JUPITER ( 1.9e+27,   7.1492e7 ),
+		SATURN  ( 5.688e+26, 6.0268e7 ),
+		URANUS  ( 8.686e+25, 2.5559e7 ),
+		NEPTUNE ( 1.024e+26, 2.4746e7 );
+
+		private final double mass;   // in kilograms
+		public final double radius; // in meters
+
+		Planet( double mass, double radius ) {
+			this.mass = mass; this.radius = radius;
+		}
+	}
+	static double mass( Planet p ) { return p.mass; }
+	static double radius( Planet p ) { return p.radius; }
+
+	static double surfaceGravity( Planet p ) {
+		return 6.67300E-11 * p.mass / ( p.radius * p.radius );
+	}
+	static double surfaceWeight( Planet p, double otherMass ) {
+		return otherMass * surfaceGravity( p );
+	}
+	public static void main( String[] args ) {
+		if ( args.length != 1 ) {
+			System.err.println( "Usage: java Planet <earth_weight>" );
+			System.exit( -1 );
+		}
+		Planet day = Planet.valueOf( "EARTH" );
+		System.out.println( day.ordinal() + " " + day.name() + " " + day.mass + " " + day.radius + " " + Planet.valueOf( "EARTH" ) ); // 5 Sat
+
+		double earthWeight = Double.parseDouble( args[0] );
+		double mass = earthWeight / surfaceGravity( Planet.EARTH );
+		for ( Planet p : Planet.values() )
+			System.out.printf( "Your weight on %s is %f%n", p, surfaceWeight( p, mass ) );
+	}
+}
+
+// java test
Index: doc/theses/jiada_liang_MMath/testP3.java
===================================================================
--- doc/theses/jiada_liang_MMath/testP3.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
+++ doc/theses/jiada_liang_MMath/testP3.java	(revision f678c53bb53e8e34a5a75ce6def17271274e1f80)
@@ -0,0 +1,41 @@
+import java.io.*;
+import java.util.Random;
+
+public class testP3 {
+	static Random rand = new Random();
+	enum Weekday {
+		Mon(rand.nextInt()), Tue(rand.nextInt()), Wed(rand.nextInt()), Thu(rand.nextInt()), Fri(rand.nextInt()),
+		Sat(rand.nextInt()), Sun(rand.nextInt()); // must appear first
+		private int day;
+		private Weekday( int d ) { day = d; }
+
+		public boolean isWeekday() {
+			return day <= Fri.day;
+		}
+		public boolean isWeekend() {
+			return Fri.day < (int)day;
+		}
+	}
+
+	public static void main( String[] args ) {
+		Weekday day = Weekday.Sat;
+		System.out.println( day.ordinal() + " " + day.day + " " + day.name() );
+		for ( Weekday iday : day.values() ) {
+			System.out.print( iday.ordinal() + " " + iday.day + " " + iday.name() + ",  " );
+		}
+		System.out.println();
+		System.out.println( day.isWeekday() );  // false
+		System.out.println( day.isWeekend() );  // true
+
+		Weekday day2 = Weekday.Sat;
+		System.out.println( day2.ordinal() + " " + day2.day + " " +  day2.name() );
+		for ( Weekday iday : day2.values() ) {
+			System.out.print( iday.ordinal() + " " + iday.day + " " + iday.name() + ",  " );
+		}
+		System.out.println();
+		System.out.println( day2.isWeekday() );  // false
+		System.out.println( day2.isWeekend() );  // true
+	}
+}
+
+// java test
