Index: doc/theses/jiada_liang_MMath/relatedwork.tex
===================================================================
--- doc/theses/jiada_liang_MMath/relatedwork.tex	(revision 956299bfb54cdd0289b10d4a75fecc95d3dea2c8)
+++ doc/theses/jiada_liang_MMath/relatedwork.tex	(revision f936e234f9d6548fc2b43d4a611f6dfcfd9c3a24)
@@ -5,28 +5,47 @@
 There are a large set of overlapping features among these languages, but each language has its own unique restrictions and extensions.
 
+
 \section{(Free) Pascal}
+
+\lstnewenvironment{pascal}[1][]{% necessary
+\lstset{
+language=pascal,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
 
 Free Pascal is a modern object-oriented version of the classic Pascal programming language.
 It allows a C-style enumeration type, where enumerators must be in assigned in ascending numerical order with a constant expression and the range can be non-consecutive.
-\begin{lstlisting}[language=pascal,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{pascal}
 Type EnumType = ( one, two, three, forty @= 40@, fortyone );
-\end{lstlisting}
+\end{pascal}
 Pseudo-functions @Pred@ and @Succ@ can only be used if the range is consecutive.
 The underlying type is an implementation-defined integral type large enough to hold all enumerated values; it does not have to be the smallest possible type.
 The size underlying integral type can be explicitly specified using compiler directive @$PACKENUM@~$N$, where $N$ is the number of bytes, e.g.:
-\begin{lstlisting}[language=pascal,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{pascal}
 Type @{$\color{red}\$$PACKENUM 1}@ SmallEnum = ( one, two, three );
 	    @{$\color{red}\$$PACKENUM 4}@ LargeEnum = ( BigOne, BigTwo, BigThree );
 Var S : SmallEnum; { 1 byte }
 	  L : LargeEnum; { 4 bytes}
-\end{lstlisting}
+\end{pascal}
 
 
 \section{Ada}
 
+\lstnewenvironment{ada}[1][]{% necessary
+\lstset{
+language=ada,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
+
 An enumeration type is defined as a list of possible values:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type RGB is (Red, Green, Blue);
-\end{lstlisting}
+\end{ada}
 Like for numeric types, where e.g., 1 is an integer literal, @Red@, @Green@ and @Blue@ are called the literals of this type.
 There are no other values assignable to objects of this type.
@@ -36,14 +55,14 @@
 Each literal has a position, starting with 0 for the first, incremented by one for each successor.
 This position can be queried via the @'Pos@ attribute; the inverse is @'Val@, which returns the corresponding literal. In our example:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 RGB'Pos (Red) = 0
 RGB'Val (0)   = Red
-\end{lstlisting}
+\end{ada}
 There are two other important attributes: @Image@ and @Value@.
 @Image@ returns the string representation of the value (in capital letters), @Value@ is the inverse:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 RGB'Image ( Red ) = "RED"
 RGB'Value ("Red") =  Red
-\end{lstlisting}
+\end{ada}
 These attributes are important for simple IO (there are more elaborate IO facilities in @Ada.Text_IO@ for enumeration types).
 Note that, since Ada is case-insensitive, the string given to @'Value@ can be in any case.
@@ -51,17 +70,17 @@
 \paragraph{Enumeration literals} ~\newline
 Literals are overloadable, i.e. you can have another type with the same literals.
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type Traffic_Light is (Red, Yellow, Green);
-\end{lstlisting}
+\end{ada}
 Overload resolution within the context of use of a literal normally resolves which @Red@ is meant.
 Only if you have an unresolvable overloading conflict, you can qualify with special syntax which @Red@ is meant:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 RGB'(Red)
-\end{lstlisting}
+\end{ada}
 Like many other declarative items, enumeration literals can be renamed.
 In fact, such a literal is actually a function, so it has to be renamed as such:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 function Red return P.RGB renames P.Red;
-\end{lstlisting}
+\end{ada}
 Here, @RGB@ is assumed to be defined in package @P@, which is visible at the place of the renaming declaration.
 Renaming makes @Red@ directly visible without necessity to resort the use-clause.
@@ -71,12 +90,12 @@
 \paragraph{Characters as enumeration literals} ~\newline
 Rather unique to Ada is the use of character literals as enumeration literals:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type ABC is ('A', 'B', 'C');
-\end{lstlisting}
+\end{ada}
 This literal @'A'@ has nothing in common with the literal @'A'@ of the predefined type @Character@ (or @Wide_Character@).
 
 Every type that has at least one character literal is a character type.
 For every character type, string literals and the concatenation operator @"&"@ are also implicitly defined.
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type My_Character is (No_Character, 'a', Literal, 'z');
 type My_String is array (Positive range <>) of My_Character;
@@ -84,5 +103,5 @@
 S: My_String := "aa" & Literal & "za" & 'z';
 T: My_String := ('a', 'a', Literal, 'z', 'a', 'z');
-\end{lstlisting}
+\end{ada}
 In this example, @S@ and @T@ have the same value.
 
@@ -92,37 +111,37 @@
 \paragraph{Booleans as enumeration literals} ~\newline
 Also Booleans are defined as enumeration types:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type Boolean is (False, True);
-\end{lstlisting}
+\end{ada}
 There is special semantics implied with this declaration in that objects and expressions of this type can be used as conditions.
 Note that the literals @False@ and @True@ are not Ada keywords.
 
 Thus it is not sufficient to declare a type with these literals and then hope objects of this type can be used like so:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type My_Boolean is (False, True);
 Condition: My_Boolean;
 
 if Condition then -- wrong, won't compile
-\end{lstlisting}
+\end{ada}
 
 If you need your own Booleans (perhaps with special size requirements), you have to derive from the predefined Boolean:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type My_Boolean is new Boolean;
 Condition: My_Boolean;
 
 if Condition then -- OK
-\end{lstlisting}
+\end{ada}
 
 \paragraph{Enumeration subtypes} ~\newline
 You can use range to subtype an enumeration type:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 subtype Capital_Letter is Character range 'A' .. 'Z';
 type Day_Of_Week is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
 subtype Working_Day is Day_Of_Week range Monday .. Friday;
-\end{lstlisting}
+\end{ada}
 
 \paragraph{Using enumerations} ~\newline
 Enumeration types being scalar subtypes, type attributes such as @First@ and @Succ@ will allow stepping through a subsequence of the values.
-\begin{lstlisting}[language=ada]
+\begin{ada}
 case Day_Of_Week'First is
 	when Sunday =>
@@ -133,8 +152,8 @@
 	   raise Program_Error;
 end case;
-\end{lstlisting}
+\end{ada}
 A loop will automatically step through the values of the subtype's range.
 Filtering week days to include only working days with an even position number:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 	for Day in Working_Day loop
 		if Day_Of_Week'Pos(Day) mod 2 = 0 then
@@ -142,14 +161,14 @@
 		end if;
 	end loop;
-\end{lstlisting}
+\end{ada}
 Enumeration types can be used as array index subtypes, yielding a table feature:
-\begin{lstlisting}[language=ada]
+\begin{ada}
 type Officer_ID is range 0 .. 50;
 type Schedule is array (Working_Day) of Officer_ID;
-\end{lstlisting}
-
-\begin{lstlisting}[language=ada]
+\end{ada}
+
+\begin{ada}
 type Subtype_Name is (Id1, Id2, Id3 ... );
-\end{lstlisting}
+\end{ada}
 where @Id1@, @Id2@, etc. are identifiers or characters literals.
 In either case, the legal values of the type are referred to as "enumeration literals."
@@ -171,376 +190,140 @@
 \section{C\raisebox{-0.7ex}{\LARGE$^\sharp$}\xspace} % latex bug: cannot use \relsize{2} so use \LARGE
 
-\lstdefinelanguage{swift}
+\lstnewenvironment{csharp}[1][]{% necessary
+\lstset{
+language=[Sharp]C,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
+
+An enumeration type (or enum type) is a value type defined by a set of named constants of the underlying integral numeric type.
+To define an enumeration type, use the enum keyword and specify the names of enum members:
+\begin{csharp}
+enum Season {
+	Spring,
+	Summer,
+	Autumn,
+	Winter
+}
+\end{csharp}
+By default, the associated constant values of enum members are of type @int@;
+they start with zero and increase by one following the definition text order.
+
+You can explicitly specify any other integral numeric type as an underlying type of an enumeration type.
+You can also explicitly specify the associated constant values, as the following example shows:
+\begin{csharp}
+enum ErrorCode : ushort {
+	None = 0,
+	Unknown = 1,
+	ConnectionLost = 100,
+	OutlierReading = 200
+}
+\end{csharp}
+You cannot define a method inside the definition of an enumeration type.
+To add functionality to an enumeration type, create an extension method.
+
+The default value of an enumeration type @E@ is the value produced by expression @(E)0@, even if zero doesn't have the corresponding enum member.
+
+You use an enumeration type to represent a choice from a set of mutually exclusive values or a combination of choices.
+To represent a combination of choices, define an enumeration type as bit flags.
+
+\paragraph{Enumeration types as bit flags}
+
+If you want an enumeration type to represent a combination of choices, define enum members for those choices such that an individual choice is a bit field.
+That is, the associated values of those enum members should be the powers of two.
+Then, you can use the bitwise logical operators @|@ or @&@ to combine choices or intersect combinations of choices, respectively.
+To indicate that an enumeration type declares bit fields, apply the @Flags@ attribute to it.
+As the following example shows, you can also include some typical combinations in the definition of an enumeration type.
+\begin{csharp}
+[Flags]
+public enum Days {
+	None	  = 0b_0000_0000,  // 0
+	Monday	= 0b_0000_0001,  // 1
+	Tuesday   = 0b_0000_0010,  // 2
+	Wednesday = 0b_0000_0100,  // 4
+	Thursday  = 0b_0000_1000,  // 8
+	Friday	= 0b_0001_0000,  // 16
+	Saturday  = 0b_0010_0000,  // 32
+	Sunday	= 0b_0100_0000,  // 64
+	Weekend   = Saturday | Sunday
+}
+
+public class FlagsEnumExample {
+	public static void Main() {
+		Days meetingDays = Days.Monday | Days.Wednesday | Days.Friday;
+		Console.WriteLine(meetingDays);
+		// Output:
+		// Monday, Wednesday, Friday
+
+		Days workingFromHomeDays = Days.Thursday | Days.Friday;
+		Console.WriteLine($\$$"Join a meeting by phone on {meetingDays & workingFromHomeDays}");
+		// Output:
+		// Join a meeting by phone on Friday
+
+		bool isMeetingOnTuesday = (meetingDays & Days.Tuesday) == Days.Tuesday;
+		Console.WriteLine($\$$"Is there a meeting on Tuesday: {isMeetingOnTuesday}");
+		// Output:
+		// Is there a meeting on Tuesday: False
+
+		var a = (Days)37;
+		Console.WriteLine(a);
+		// Output:
+		// Monday, Wednesday, Saturday
+	}
+}
+\end{csharp}
+For more information and examples, see the System.FlagsAttribute API reference page and the Non-exclusive members and the Flags attribute section of the System.Enum API reference page.
+
+\paragraph{The System.Enum type and enum constraint}
+
+The System.Enum type is the abstract base class of all enumeration types.
+It provides a number of methods to get information about an enumeration type and its values.
+For more information and examples, see the System.Enum API reference page.
+
+You can use System.Enum in a base class constraint (that is known as the enum constraint) to specify that a type parameter is an enumeration type.
+Any enumeration type also satisfies the struct constraint, which is used to specify that a type parameter is a non-nullable value type.
+Conversions
+
+For any enumeration type, there exist explicit conversions between the enumeration type and its underlying integral type.
+If you cast an enum value to its underlying type, the result is the associated integral value of an enum member.
+\begin{csharp}
+public enum Season
 {
-  morekeywords={
-    open,catch,@escaping,nil,throws,func,if,then,else,for,in,while,do,switch,case,default,where,break,continue,fallthrough,return,
-    typealias,struct,class,enum,protocol,var,func,let,get,set,willSet,didSet,inout,init,deinit,extension,
-    subscript,prefix,operator,infix,postfix,precedence,associativity,left,right,none,convenience,dynamic,
-    final,lazy,mutating,nonmutating,optional,override,required,static,unowned,safe,weak,internal,
-    private,public,is,as,self,unsafe,dynamicType,true,false,nil,Type,Protocol,
-  },
-  morecomment=[l]{//}, % l is for line comment
-  morecomment=[s]{/*}{*/}, % s is for start and end delimiter
-  morestring=[b]", % defines that strings are enclosed in double quotes
-  breaklines=true,
-  escapeinside={\%*}{*)},
-%  numbers=left,
-  captionpos=b,
-  breakatwhitespace=true,
-  basicstyle=\linespread{0.9}\sf, % https://tex.stackexchange.com/a/102728/129441
-}
-
-Model custom types that define a list of possible values.
-
-An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your code.
-
-If you are familiar with C, you will know that C enumerations assign related names to a set of integer values.
-Enumerations in Swift are much more flexible, and don't have to provide a value for each case of the enumeration.
-If a value (known as a raw value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.
-
-Alternatively, enumeration cases can specify associated values of any type to be stored along with each different case value, much as unions or variants do in other languages.
-You can define a common set of related cases as part of one enumeration, each of which has a different set of values of appropriate types associated with it.
-
-Enumerations in Swift are first-class types in their own right.
-They adopt many features traditionally supported only by classes, such as computed properties to provide additional information about the enumeration's current value, and instance methods to provide functionality related to the values the enumeration represents.
-Enumerations can also define initializers to provide an initial case value;
-can be extended to expand their functionality beyond their original implementation; and can conform to protocols to provide standard functionality.
-
-For more about these capabilities, see Properties, Methods, Initialization, Extensions, and Protocols.
-
-\paragraph{Enumeration Syntax}
-
-You introduce enumerations with the @enum@ keyword and place their entire definition within a pair of braces:
-\begin{lstlisting}[language=swift]
-enum SomeEnumeration {
-    // enumeration definition goes here
-}
-\end{lstlisting}
-Here's an example for the four main points of a compass:
-\begin{lstlisting}[language=swift]
-enum CompassPoint {
-    case north
-    case south
-    case east
-    case west
-}
-\end{lstlisting}
-The values defined in an enumeration (such as @north@, @south@, @east@, and @west@) are its enumeration cases.
-You use the @case@ keyword to introduce new enumeration cases.
-
-Note:
-Swift enumeration cases don't have an integer value set by default, unlike languages like C and Objective-C.
-In the CompassPoint example above, @north@, @south@, @east@ and @west@ don't implicitly equal 0, 1, 2 and 3.
-Instead, the different enumeration cases are values in their own right, with an explicitly defined type of CompassPoint.
-
-Multiple cases can appear on a single line, separated by commas:
-\begin{lstlisting}[language=swift]
-enum Planet {
-    case mercury, venus, earth, mars, jupiter, saturn, uranus, neptune
-}
-\end{lstlisting}
-Each enumeration definition defines a new type.
-Like other types in Swift, their names (such as @CompassPoint@ and @Planet@) start with a capital letter.
-Give enumeration types singular rather than plural names, so that they read as self-evident:
-\begin{lstlisting}[language=swift]
-var directionToHead = CompassPoint.west
-\end{lstlisting}
-The type of @directionToHead@ is inferred when it's initialized with one of the possible values of @CompassPoint@.
-Once @directionToHead@ is declared as a @CompassPoint@, you can set it to a different @CompassPoint@ value using a shorter dot syntax:
-\begin{lstlisting}[language=swift]
-directionToHead = .east
-\end{lstlisting}
-The type of @directionToHead@ is already known, and so you can drop the type when setting its value.
-This makes for highly readable code when working with explicitly typed enumeration values.
-
-\paragraph{Matching Enumeration Values with a Switch Statement}
-
-You can match individual enumeration values with a switch statement:
-\begin{lstlisting}[language=swift]
-directionToHead = .south
-switch directionToHead {
-case .north:
-    print("Lots of planets have a north")
-case .south:
-    print("Watch out for penguins")
-case .east:
-    print("Where the sun rises")
-case .west:
-    print("Where the skies are blue")
-}
-// Prints "Watch out for penguins"
-\end{lstlisting}
-You can read this code as:
-\begin{quote}
-"Consider the value of directionToHead.
-In the case where it equals @.north@, print "Lots of planets have a north".
-In the case where it equals @.south@, print "Watch out for penguins"."
-
-...and so on.
-\end{quote}
-As described in Control Flow, a switch statement must be exhaustive when considering an enumeration's cases.
-If the case for @.west@ is omitted, this code doesn't compile, because it doesn't consider the complete list of @CompassPoint@ cases.
-Requiring exhaustiveness ensures that enumeration cases aren't accidentally omitted.
-
-When it isn't appropriate to provide a case for every enumeration case, you can provide a default case to cover any cases that aren't addressed explicitly:
-\begin{lstlisting}[language=swift]
-let somePlanet = Planet.earth
-switch somePlanet {
-case .earth:
-    print("Mostly harmless")
-default:
-    print("Not a safe place for humans")
-}
-// Prints "Mostly harmless"
-\end{lstlisting}
-
-\paragraph{Iterating over Enumeration Cases}
-
-For some enumerations, it's useful to have a collection of all of that enumeration's cases.
-You enable this by writing @CaseIterable@ after the enumeration's name.
-Swift exposes a collection of all the cases as an allCases property of the enumeration type.
-Here's an example:
-\begin{lstlisting}[language=swift]
-enum Beverage: CaseIterable {
-    case coffee, tea, juice
-}
-let numberOfChoices = Beverage.allCases.count
-print("\(numberOfChoices) beverages available")
-// Prints "3 beverages available"
-\end{lstlisting}
-In the example above, you write @Beverage.allCases@ to access a collection that contains all of the cases of the @Beverage@ enumeration.
-You can use @allCases@ like any other collection -- the collection's elements are instances of the enumeration type, so in this case they're Beverage values.
-The example above counts how many cases there are, and the example below uses a for-in loop to iterate over all the cases.
-\begin{lstlisting}[language=swift]
-for beverage in Beverage.allCases {
-    print(beverage)
-}
-// coffee
-// tea
-// juice
-\end{lstlisting}
-The syntax used in the examples above marks the enumeration as conforming to the @CaseIterable@ protocol.
-For information about protocols, see Protocols.
-
-\paragraph{Associated Values}
-The examples in the previous section show how the cases of an enumeration are a defined (and typed) value in their own right.
-You can set a constant or variable to Planet.earth, and check for this value later.
-However, it's sometimes useful to be able to store values of other types alongside these case values.
-This additional information is called an associated value, and it varies each time you use that case as a value in your code.
-
-You can define Swift enumerations to store associated values of any given type, and the value types can be different for each case of the enumeration if needed.
-Enumerations similar to these are known as discriminated unions, tagged unions, or variants in other programming languages.
-
-For example, suppose an inventory tracking system needs to track products by two different types of barcode.
-Some products are labeled with 1D barcodes in UPC format, which uses the numbers 0 to 9.
-Each barcode has a number system digit, followed by five manufacturer code digits and five product code digits.
-These are followed by a check digit to verify that the code has been scanned correctly:
-
-Other products are labeled with 2D barcodes in QR code format, which can use any ISO 8859-1 character and can encode a string up to 2,953 characters long:
-
-It's convenient for an inventory tracking system to store UPC barcodes as a tuple of four integers, and QR code barcodes as a string of any length.
-
-In Swift, an enumeration to define product barcodes of either type might look like this:
-\begin{lstlisting}[language=swift]
-enum Barcode {
-    case upc(Int, Int, Int, Int)
-    case qrCode(String)
-}
-\end{lstlisting}
-This can be read as:
-\begin{quote}
-"Define an enumeration type called Barcode, which can take either a value of upc with an associated value of type @(Int, Int, Int, Int)@, or a value of @qrCode@ with an associated value of type @String@."
-\end{quote}
-This definition doesn't provide any actual @Int@ or @String@ values -- it just defines the type of associated values that Barcode constants and variables can store when they're equal to @Barcode.upc@ or @Barcode.qrCode@.
-
-You can then create new barcodes using either type:
-\begin{lstlisting}[language=swift]
-var productBarcode = Barcode.upc(8, 85909, 51226, 3)
-\end{lstlisting}
-This example creates a new variable called @productBarcode@ and assigns it a value of @Barcode.upc@ with an associated tuple value of @(8, 85909, 51226, 3)@.
-
-You can assign the same product a different type of barcode:
-\begin{lstlisting}[language=swift]
-productBarcode = .qrCode("ABCDEFGHIJKLMNOP")
-\end{lstlisting}
-At this point, the original @Barcode.upc@ and its integer values are replaced by the new @Barcode.qrCode@ and its string value.
-Constants and variables of type Barcode can store either a @.upc@ or a @.qrCode@ (together with their associated values), but they can store only one of them at any given time.
-
-You can check the different barcode types using a switch statement, similar to the example in Matching Enumeration Values with a Switch Statement.
-This time, however, the associated values are extracted as part of the switch statement.
-You extract each associated value as a constant (with the let prefix) or a variable (with the var prefix) for use within the switch case's body:
-\begin{lstlisting}[language=swift][language=swift]
-switch productBarcode {
-case .upc(let numberSystem, let manufacturer, let product, let check):
-    print("UPC: \(numberSystem), \(manufacturer), \(product), \(check).")
-case .qrCode(let productCode):
-    print("QR code: \(productCode).")
-}
-// Prints "QR code: ABCDEFGHIJKLMNOP."
-\end{lstlisting}
-If all of the associated values for an enumeration case are extracted as constants, or if all are extracted as variables, you can place a single let or var annotation before the case name, for brevity:
-\begin{lstlisting}[language=swift]
-switch productBarcode {
-case let .upc(numberSystem, manufacturer, product, check):
-    print("UPC : \(numberSystem), \(manufacturer), \(product), \(check).")
-case let .qrCode(productCode):
-    print("QR code: \(productCode).")
-}
-// Prints "QR code: ABCDEFGHIJKLMNOP."
-\end{lstlisting}
-
-\paragraph{Raw Values}
-
-The barcode example in Associated Values shows how cases of an enumeration can declare that they store associated values of different types.
-As an alternative to associated values, enumeration cases can come prepopulated with default values (called raw values), which are all of the same type.
-
-Here's an example that stores raw ASCII values alongside named enumeration cases:
-\begin{lstlisting}[language=swift]
-enum ASCIIControlCharacter: Character {
-    case tab = "\t"
-    case lineFeed = "\n"
-    case carriageReturn = "\r"
-}
-\end{lstlisting}
-Here, the raw values for an enumeration called ASCIIControlCharacter are defined to be of type Character, and are set to some of the more common ASCII control characters.
-Character values are described in Strings and Characters.
-
-Raw values can be strings, characters, or any of the integer or floating-point number types.
-Each raw value must be unique within its enumeration declaration.
-
-Note
-
-Raw values are not the same as associated values.
-Raw values are set to prepopulated values when you first define the enumeration in your code, like the three ASCII codes above.
-The raw value for a particular enumeration case is always the same.
-Associated values are set when you create a new constant or variable based on one of the enumeration's cases, and can be different each time you do so.
-Implicitly Assigned Raw Values
-
-When you're working with enumerations that store integer or string raw values, you don't have to explicitly assign a raw value for each case.
-When you don't, Swift automatically assigns the values for you.
-
-For example, when integers are used for raw values, the implicit value for each case is one more than the previous case.
-If the first case doesn't have a value set, its value is 0.
-
-The enumeration below is a refinement of the earlier Planet enumeration, with integer raw values to represent each planet's order from the sun:
-
-\begin{lstlisting}[language=swift]
-enum Planet: Int {
-    case mercury = 1, venus, earth, mars, jupiter, saturn, uranus, neptune
-}
-\end{lstlisting}
-In the example above, Planet.mercury has an explicit raw value of 1, Planet.venus has an implicit raw value of 2, and so on.
-
-When strings are used for raw values, the implicit value for each case is the text of that case's name.
-
-The enumeration below is a refinement of the earlier CompassPoint enumeration, with string raw values to represent each direction's name:
-\begin{lstlisting}[language=swift]
-enum CompassPoint: String {
-    case north, south, east, west
-}
-\end{lstlisting}
-In the example above, CompassPoint.south has an implicit raw value of "south", and so on.
-
-You access the raw value of an enumeration case with its rawValue property:
-\begin{lstlisting}[language=swift]
-let earthsOrder = Planet.earth.rawValue
-// earthsOrder is 3
-
-let sunsetDirection = CompassPoint.west.rawValue
-// sunsetDirection is "west"
-\end{lstlisting}
-
-\paragraph{Initializing from a Raw Value}
-
-If you define an enumeration with a raw-value type, the enumeration automatically receives an initializer that takes a value of the raw value's type (as a parameter called rawValue) and returns either an enumeration case or nil.
-You can use this initializer to try to create a new instance of the enumeration.
-
-This example identifies Uranus from its raw value of 7:
-\begin{lstlisting}[language=swift]
-let possiblePlanet = Planet(rawValue: 7)
-// possiblePlanet is of type Planet? and equals Planet.uranus
-\end{lstlisting}
-Not all possible Int values will find a matching planet, however.
-Because of this, the raw value initializer always returns an optional enumeration case.
-In the example above, possiblePlanet is of type Planet?, or "optional Planet."
-Note
-
-The raw value initializer is a failable initializer, because not every raw value will return an enumeration case.
-For more information, see Failable Initializers.
-
-If you try to find a planet with a position of 11, the optional Planet value returned by the raw value initializer will be nil:
-\begin{lstlisting}[language=swift]
-let positionToFind = 11
-if let somePlanet = Planet(rawValue: positionToFind) {
-    switch somePlanet {
-    case .earth:
-        print("Mostly harmless")
-    default:
-        print("Not a safe place for humans")
-    }
-} else {
-    print("There isn't a planet at position \(positionToFind)")
-}
-// Prints "There isn't a planet at position 11"
-\end{lstlisting}
-This example uses optional binding to try to access a planet with a raw value of 11.
-The statement if let somePlanet = Planet(rawValue: 11) creates an optional Planet, and sets somePlanet to the value of that optional Planet if it can be retrieved.
-In this case, it isn't possible to retrieve a planet with a position of 11, and so the else branch is executed instead.
-
-\paragraph{Recursive Enumerations}
-
-A recursive enumeration is an enumeration that has another instance of the enumeration as the associated value for one or more of the enumeration cases.
-You indicate that an enumeration case is recursive by writing indirect before it, which tells the compiler to insert the necessary layer of indirection.
-
-For example, here is an enumeration that stores simple arithmetic expressions:
-\begin{lstlisting}[language=swift]
-enum ArithmeticExpression {
-    case number(Int)
-    indirect case addition(ArithmeticExpression, ArithmeticExpression)
-    indirect case multiplication(ArithmeticExpression, ArithmeticExpression)
-}
-\end{lstlisting}
-You can also write indirect before the beginning of the enumeration to enable indirection for all of the enumeration's cases that have an associated value:
-\begin{lstlisting}[language=swift]
-indirect enum ArithmeticExpression {
-    case number(Int)
-    case addition(ArithmeticExpression, ArithmeticExpression)
-    case multiplication(ArithmeticExpression, ArithmeticExpression)
-}
-\end{lstlisting}
-This enumeration can store three kinds of arithmetic expressions: a plain number, the addition of two expressions, and the multiplication of two expressions.
-The addition and multiplication cases have associated values that are also arithmetic expressions -- these associated values make it possible to nest expressions.
-For example, the expression (5 + 4) * 2 has a number on the right-hand side of the multiplication and another expression on the left-hand side of the multiplication.
-Because the data is nested, the enumeration used to store the data also needs to support nesting -- this means the enumeration needs to be recursive.
-The code below shows the ArithmeticExpression recursive enumeration being created for (5 + 4) * 2:
-\begin{lstlisting}[language=swift]
-let five = ArithmeticExpression.number(5)
-let four = ArithmeticExpression.number(4)
-let sum = ArithmeticExpression.addition(five, four)
-let product = ArithmeticExpression.multiplication(sum, ArithmeticExpression.number(2))
-\end{lstlisting}
-A recursive function is a straightforward way to work with data that has a recursive structure.
-For example, here's a function that evaluates an arithmetic expression:
-\begin{lstlisting}[language=swift]
-func evaluate(_ expression: ArithmeticExpression) -> Int {
-    switch expression {
-    case let .number(value):
-        return value
-    case let .addition(left, right):
-        return evaluate(left) + evaluate(right)
-    case let .multiplication(left, right):
-        return evaluate(left) * evaluate(right)
-    }
-}
-
-print(evaluate(product))
-// Prints "18"
-\end{lstlisting}
-This function evaluates a plain number by simply returning the associated value.
-It evaluates an addition or multiplication by evaluating the expression on the left-hand side, evaluating the expression on the right-hand side, and then adding them or multiplying them.
+	Spring,
+	Summer,
+	Autumn,
+	Winter
+}
+
+public class EnumConversionExample
+{
+	public static void Main()
+	{
+		Season a = Season.Autumn;
+		Console.WriteLine($\$$"Integral value of {a} is {(int)a}");  // output: Integral value of Autumn is 2
+
+		var b = (Season)1;
+		Console.WriteLine(b);  // output: Summer
+
+		var c = (Season)4;
+		Console.WriteLine(c);  // output: 4
+	}
+}
+\end{csharp}
 
 
 \section{\CC}
 \label{s:C++RelatedWork}
+
+\lstnewenvironment{c++}[1][]{% necessary
+\lstset{
+language=C++,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
 
 \CC is backwards compatible with C, so it inherited C's enumerations.
@@ -550,9 +333,9 @@
 In C, objects of enumeration type can be assigned values of any integral type. \\
 Example:
-\begin{lstlisting}[language=c++]
+\begin{c++}
 enum color { red, blue, green };
 color c = 1;			 				$\C{// valid C, invalid C++}$
-\end{lstlisting}
-\textbf{Rationale}: The type-safe nature of C++. \\
+\end{c++}
+\textbf{Rationale}: The type-safe nature of \CC. \\
 \textbf{Effect on original feature}: Deletion of semantically well-defined feature. \\
 \textbf{Difficulty of converting}: Syntactic transformation. (The type error produced by the assignment can be automatically corrected by applying an explicit cast.) \\
@@ -563,11 +346,11 @@
 In C, the type of an enumerator is @int@. \\
 Example:
-\begin{lstlisting}[language=c++]
+\begin{c++}
 enum e { A };
 sizeof(A) == sizeof(int)		 		$\C{// in C}$
 sizeof(A) == sizeof(e)		 			$\C{// in C++}$
 /* and sizeof(int) is not necessary equal to sizeof(e) */
-\end{lstlisting}
-\textbf{Rationale}: In C++, an enumeration is a distinct type. \\
+\end{c++}
+\textbf{Rationale}: In \CC, an enumeration is a distinct type. \\
 \textbf{Effect on original feature}: Change to semantics of well-defined feature. \\
 \textbf{Difficulty of converting}: Semantic transformation. \\
@@ -577,33 +360,33 @@
 Hence, the values in a \CC enumeration can only be its enumerators (without a cast).
 While the storage size of an enumerator is up to the compiler, there is still an implicit cast to @int@.
-\begin{lstlisting}[language=c++]
+\begin{c++}
 enum E { A, B, C };
 E e = A;
 int i = A;   i = e;	 					$\C{// implicit casts to int}$
-\end{lstlisting}
+\end{c++}
 \CC{11} added a scoped enumeration, \lstinline[language=c++]{enum class} (or \lstinline[language=c++]{enum struct}), so the enumerators are local to the enumeration and must be accessed using type qualification.
-\begin{lstlisting}[language=c++,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{c++}
 enum class E { A, B, C };
 E e = @E::@A;	 						$\C{// qualified enumerator}$
 e = B;	 								$\C{// B not in scope}$
-\end{lstlisting}
+\end{c++}
 \CC{20} supports unscoped access with a \lstinline[language=c++]{using enum} declaration.
-\begin{lstlisting}[language=c++,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{c++}
 enum class E { A, B, C };
 @using enum E;@
 E e = A;	 							$\C{// direct access}$
 e = B;	 								$\C{// direct access}$
-\end{lstlisting}
+\end{c++}
 \CC{11} added the ability to explicitly declare the underlying integral type for \lstinline[language=c++]{enum class}.
-\begin{lstlisting}[language=c++,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{c++}
 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 };
-\end{lstlisting}
+\end{c++}
 There is no implicit conversion from the \lstinline[language=c++]{enum class} type and to its type.
-\begin{lstlisting}[language=c++,{moredelim=**[is][\color{red}]{@}{@}}]
+\begin{c++}
 rgb crgb = rgb::Red;
 char ch = rgb::Red;   ch = crgb;		$\C{// disallowed}$
-\end{lstlisting}
+\end{c++}
 Finally, there is no mechanism to iterate through an enumeration nor use the enumeration type to declare an array dimension.
 
@@ -611,4 +394,93 @@
 \section{Go}
 
+\lstnewenvironment{Go}[1][]{% necessary
+\lstset{
+language=Go,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
+
+What Is an Enum in Golang?
+
+An enumerator, or enum, is a data type in Golang that consists of a set of named, constant values. While Golang doesn't support enums, it can be implemented using the identifier iota with constants.
+
+However, in Golang, they're implemented quite differently than most other programming languages. Golang doesn't support enums directly, however, we can implement it using iota and constants.
+
+In order to implement enums in Golang, let's first understand what iota is and how it is used.
+
+ 
+What Is Iota in Golang?
+
+iota is an identifier that is used with constant and can simplify constant definitions that use auto-increment numbers. The iota keyword represents integer constant starting from zero.
+
+The iota keyword represents successive integer constants 0, 1, 2, \ldots.
+It resets to 0 whenever the word const appears in the source code and increments after each const specification.
+\begin{Go}
+package main
+
+import "fmt"
+
+const (
+	c0 = iota
+	c1 = iota
+	c2 = iota
+)
+func main() {
+	fmt.Println(c0, c1, c2) //Print : 0 1 2
+}
+\end{Go}
+You can avoid writing successive iota in front of every constant. This can be simplified as in the below code listing:
+\begin{Go}
+package main
+
+import "fmt"
+
+const (
+	c0 = iota
+	c1
+	c2
+)
+
+func main() {
+	fmt.Println(c0, c1, c2) //Print : 0 1 2
+}
+\end{Go}
+To start a list of constants at 1 instead of 0, you can use iota in an arithmetic expression.
+\begin{Go}
+package main
+
+import "fmt"
+
+const (
+	c0 = iota + 1
+	c1
+	c2
+)
+
+func main() {
+	fmt.Println(c0, c1, c2) // Print : 1 2 3
+}
+\end{Go}
+You can use the blank identifier to skip a value in a list of constants.
+\begin{Go}
+package main
+
+import "fmt"
+
+const (
+	c1 = iota + 1
+	_
+	c3
+	c4
+)
+
+func main() {
+	fmt.Println(c1, c3, c4) // Print : 1 3 4
+}
+\end{Go}
+
+
 \section{Java}
 
@@ -617,6 +489,366 @@
 \section{Rust}
 
+
 \section{Swift}
 
+\lstnewenvironment{swift}[1][]{% necessary
+\lstset{
+language=Swift,
+escapechar=\$,				% LaTeX escape in CFA code
+moredelim=**[is][\color{red}]{@}{@},	% red highlighting @...@
+}% lstset
+\lstset{#1}% necessary
+}{}
+
+Model custom types that define a list of possible values.
+
+An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe way within your code.
+
+If you are familiar with C, you will know that C enumerations assign related names to a set of integer values.
+Enumerations in Swift are much more flexible, and don't have to provide a value for each case of the enumeration.
+If a value (known as a raw value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.
+
+Alternatively, enumeration cases can specify associated values of any type to be stored along with each different case value, much as unions or variants do in other languages.
+You can define a common set of related cases as part of one enumeration, each of which has a different set of values of appropriate types associated with it.
+
+Enumerations in Swift are first-class types in their own right.
+They adopt many features traditionally supported only by classes, such as computed properties to provide additional information about the enumeration's current value, and instance methods to provide functionality related to the values the enumeration represents.
+Enumerations can also define initializers to provide an initial case value;
+can be extended to expand their functionality beyond their original implementation; and can conform to protocols to provide standard functionality.
+
+For more about these capabilities, see Properties, Methods, Initialization, Extensions, and Protocols.
+
+\paragraph{Enumeration Syntax}
+
+You introduce enumerations with the @enum@ keyword and place their entire definition within a pair of braces:
+\begin{swift}
+enum SomeEnumeration {
+	// enumeration definition goes here
+}
+\end{swift}
+Here's an example for the four main points of a compass:
+\begin{swift}
+enum CompassPoint {
+	case north
+	case south
+	case east
+	case west
+}
+\end{swift}
+The values defined in an enumeration (such as @north@, @south@, @east@, and @west@) are its enumeration cases.
+You use the @case@ keyword to introduce new enumeration cases.
+
+Note:
+Swift enumeration cases don't have an integer value set by default, unlike languages like C and Objective-C.
+In the CompassPoint example above, @north@, @south@, @east@ and @west@ don't implicitly equal 0, 1, 2 and 3.
+Instead, the different enumeration cases are values in their own right, with an explicitly defined type of CompassPoint.
+
+Multiple cases can appear on a single line, separated by commas:
+\begin{swift}
+enum Planet {
+	case mercury, venus, earth, mars, jupiter, saturn, uranus, neptune
+}
+\end{swift}
+Each enumeration definition defines a new type.
+Like other types in Swift, their names (such as @CompassPoint@ and @Planet@) start with a capital letter.
+Give enumeration types singular rather than plural names, so that they read as self-evident:
+\begin{swift}
+var directionToHead = CompassPoint.west
+\end{swift}
+The type of @directionToHead@ is inferred when it's initialized with one of the possible values of @CompassPoint@.
+Once @directionToHead@ is declared as a @CompassPoint@, you can set it to a different @CompassPoint@ value using a shorter dot syntax:
+\begin{swift}
+directionToHead = .east
+\end{swift}
+The type of @directionToHead@ is already known, and so you can drop the type when setting its value.
+This makes for highly readable code when working with explicitly typed enumeration values.
+
+\paragraph{Matching Enumeration Values with a Switch Statement}
+
+You can match individual enumeration values with a switch statement:
+\begin{swift}
+directionToHead = .south
+switch directionToHead {
+case .north:
+	print("Lots of planets have a north")
+case .south:
+	print("Watch out for penguins")
+case .east:
+	print("Where the sun rises")
+case .west:
+	print("Where the skies are blue")
+}
+// Prints "Watch out for penguins"
+\end{swift}
+You can read this code as:
+\begin{quote}
+"Consider the value of directionToHead.
+In the case where it equals @.north@, print "Lots of planets have a north".
+In the case where it equals @.south@, print "Watch out for penguins"."
+
+...and so on.
+\end{quote}
+As described in Control Flow, a switch statement must be exhaustive when considering an enumeration's cases.
+If the case for @.west@ is omitted, this code doesn't compile, because it doesn't consider the complete list of @CompassPoint@ cases.
+Requiring exhaustiveness ensures that enumeration cases aren't accidentally omitted.
+
+When it isn't appropriate to provide a case for every enumeration case, you can provide a default case to cover any cases that aren't addressed explicitly:
+\begin{swift}
+let somePlanet = Planet.earth
+switch somePlanet {
+case .earth:
+	print("Mostly harmless")
+default:
+	print("Not a safe place for humans")
+}
+// Prints "Mostly harmless"
+\end{swift}
+
+\paragraph{Iterating over Enumeration Cases}
+
+For some enumerations, it's useful to have a collection of all of that enumeration's cases.
+You enable this by writing @CaseIterable@ after the enumeration's name.
+Swift exposes a collection of all the cases as an allCases property of the enumeration type.
+Here's an example:
+\begin{swift}
+enum Beverage: CaseIterable {
+	case coffee, tea, juice
+}
+let numberOfChoices = Beverage.allCases.count
+print("\(numberOfChoices) beverages available")
+// Prints "3 beverages available"
+\end{swift}
+In the example above, you write @Beverage.allCases@ to access a collection that contains all of the cases of the @Beverage@ enumeration.
+You can use @allCases@ like any other collection -- the collection's elements are instances of the enumeration type, so in this case they're Beverage values.
+The example above counts how many cases there are, and the example below uses a for-in loop to iterate over all the cases.
+\begin{swift}
+for beverage in Beverage.allCases {
+	print(beverage)
+}
+// coffee
+// tea
+// juice
+\end{swift}
+The syntax used in the examples above marks the enumeration as conforming to the @CaseIterable@ protocol.
+For information about protocols, see Protocols.
+
+\paragraph{Associated Values}
+The examples in the previous section show how the cases of an enumeration are a defined (and typed) value in their own right.
+You can set a constant or variable to Planet.earth, and check for this value later.
+However, it's sometimes useful to be able to store values of other types alongside these case values.
+This additional information is called an associated value, and it varies each time you use that case as a value in your code.
+
+You can define Swift enumerations to store associated values of any given type, and the value types can be different for each case of the enumeration if needed.
+Enumerations similar to these are known as discriminated unions, tagged unions, or variants in other programming languages.
+
+For example, suppose an inventory tracking system needs to track products by two different types of barcode.
+Some products are labeled with 1D barcodes in UPC format, which uses the numbers 0 to 9.
+Each barcode has a number system digit, followed by five manufacturer code digits and five product code digits.
+These are followed by a check digit to verify that the code has been scanned correctly:
+
+Other products are labeled with 2D barcodes in QR code format, which can use any ISO 8859-1 character and can encode a string up to 2,953 characters long:
+
+It's convenient for an inventory tracking system to store UPC barcodes as a tuple of four integers, and QR code barcodes as a string of any length.
+
+In Swift, an enumeration to define product barcodes of either type might look like this:
+\begin{swift}
+enum Barcode {
+	case upc(Int, Int, Int, Int)
+	case qrCode(String)
+}
+\end{swift}
+This can be read as:
+\begin{quote}
+"Define an enumeration type called Barcode, which can take either a value of upc with an associated value of type @(Int, Int, Int, Int)@, or a value of @qrCode@ with an associated value of type @String@."
+\end{quote}
+This definition doesn't provide any actual @Int@ or @String@ values -- it just defines the type of associated values that Barcode constants and variables can store when they're equal to @Barcode.upc@ or @Barcode.qrCode@.
+
+You can then create new barcodes using either type:
+\begin{swift}
+var productBarcode = Barcode.upc(8, 85909, 51226, 3)
+\end{swift}
+This example creates a new variable called @productBarcode@ and assigns it a value of @Barcode.upc@ with an associated tuple value of @(8, 85909, 51226, 3)@.
+
+You can assign the same product a different type of barcode:
+\begin{swift}
+productBarcode = .qrCode("ABCDEFGHIJKLMNOP")
+\end{swift}
+At this point, the original @Barcode.upc@ and its integer values are replaced by the new @Barcode.qrCode@ and its string value.
+Constants and variables of type Barcode can store either a @.upc@ or a @.qrCode@ (together with their associated values), but they can store only one of them at any given time.
+
+You can check the different barcode types using a switch statement, similar to the example in Matching Enumeration Values with a Switch Statement.
+This time, however, the associated values are extracted as part of the switch statement.
+You extract each associated value as a constant (with the let prefix) or a variable (with the var prefix) for use within the switch case's body:
+\begin{swift}
+switch productBarcode {
+case .upc(let numberSystem, let manufacturer, let product, let check):
+	print("UPC: \(numberSystem), \(manufacturer), \(product), \(check).")
+case .qrCode(let productCode):
+	print("QR code: \(productCode).")
+}
+// Prints "QR code: ABCDEFGHIJKLMNOP."
+\end{swift}
+If all of the associated values for an enumeration case are extracted as constants, or if all are extracted as variables, you can place a single let or var annotation before the case name, for brevity:
+\begin{swift}
+switch productBarcode {
+case let .upc(numberSystem, manufacturer, product, check):
+	print("UPC : \(numberSystem), \(manufacturer), \(product), \(check).")
+case let .qrCode(productCode):
+	print("QR code: \(productCode).")
+}
+// Prints "QR code: ABCDEFGHIJKLMNOP."
+\end{swift}
+
+\paragraph{Raw Values}
+
+The barcode example in Associated Values shows how cases of an enumeration can declare that they store associated values of different types.
+As an alternative to associated values, enumeration cases can come prepopulated with default values (called raw values), which are all of the same type.
+
+Here's an example that stores raw ASCII values alongside named enumeration cases:
+\begin{swift}
+enum ASCIIControlCharacter: Character {
+	case tab = "\t"
+	case lineFeed = "\n"
+	case carriageReturn = "\r"
+}
+\end{swift}
+Here, the raw values for an enumeration called ASCIIControlCharacter are defined to be of type Character, and are set to some of the more common ASCII control characters.
+Character values are described in Strings and Characters.
+
+Raw values can be strings, characters, or any of the integer or floating-point number types.
+Each raw value must be unique within its enumeration declaration.
+
+Note
+
+Raw values are not the same as associated values.
+Raw values are set to prepopulated values when you first define the enumeration in your code, like the three ASCII codes above.
+The raw value for a particular enumeration case is always the same.
+Associated values are set when you create a new constant or variable based on one of the enumeration's cases, and can be different each time you do so.
+Implicitly Assigned Raw Values
+
+When you're working with enumerations that store integer or string raw values, you don't have to explicitly assign a raw value for each case.
+When you don't, Swift automatically assigns the values for you.
+
+For example, when integers are used for raw values, the implicit value for each case is one more than the previous case.
+If the first case doesn't have a value set, its value is 0.
+
+The enumeration below is a refinement of the earlier Planet enumeration, with integer raw values to represent each planet's order from the sun:
+
+\begin{swift}
+enum Planet: Int {
+	case mercury = 1, venus, earth, mars, jupiter, saturn, uranus, neptune
+}
+\end{swift}
+In the example above, Planet.mercury has an explicit raw value of 1, Planet.venus has an implicit raw value of 2, and so on.
+
+When strings are used for raw values, the implicit value for each case is the text of that case's name.
+
+The enumeration below is a refinement of the earlier CompassPoint enumeration, with string raw values to represent each direction's name:
+\begin{swift}
+enum CompassPoint: String {
+	case north, south, east, west
+}
+\end{swift}
+In the example above, CompassPoint.south has an implicit raw value of "south", and so on.
+
+You access the raw value of an enumeration case with its rawValue property:
+\begin{swift}
+let earthsOrder = Planet.earth.rawValue
+// earthsOrder is 3
+
+let sunsetDirection = CompassPoint.west.rawValue
+// sunsetDirection is "west"
+\end{swift}
+
+\paragraph{Initializing from a Raw Value}
+
+If you define an enumeration with a raw-value type, the enumeration automatically receives an initializer that takes a value of the raw value's type (as a parameter called rawValue) and returns either an enumeration case or nil.
+You can use this initializer to try to create a new instance of the enumeration.
+
+This example identifies Uranus from its raw value of 7:
+\begin{swift}
+let possiblePlanet = Planet(rawValue: 7)
+// possiblePlanet is of type Planet? and equals Planet.uranus
+\end{swift}
+Not all possible Int values will find a matching planet, however.
+Because of this, the raw value initializer always returns an optional enumeration case.
+In the example above, possiblePlanet is of type Planet?, or "optional Planet."
+Note
+
+The raw value initializer is a failable initializer, because not every raw value will return an enumeration case.
+For more information, see Failable Initializers.
+
+If you try to find a planet with a position of 11, the optional Planet value returned by the raw value initializer will be nil:
+\begin{swift}
+let positionToFind = 11
+if let somePlanet = Planet(rawValue: positionToFind) {
+	switch somePlanet {
+	case .earth:
+		print("Mostly harmless")
+	default:
+		print("Not a safe place for humans")
+	}
+} else {
+	print("There isn't a planet at position \(positionToFind)")
+}
+// Prints "There isn't a planet at position 11"
+\end{swift}
+This example uses optional binding to try to access a planet with a raw value of 11.
+The statement if let somePlanet = Planet(rawValue: 11) creates an optional Planet, and sets somePlanet to the value of that optional Planet if it can be retrieved.
+In this case, it isn't possible to retrieve a planet with a position of 11, and so the else branch is executed instead.
+
+\paragraph{Recursive Enumerations}
+
+A recursive enumeration is an enumeration that has another instance of the enumeration as the associated value for one or more of the enumeration cases.
+You indicate that an enumeration case is recursive by writing indirect before it, which tells the compiler to insert the necessary layer of indirection.
+
+For example, here is an enumeration that stores simple arithmetic expressions:
+\begin{swift}
+enum ArithmeticExpression {
+	case number(Int)
+	indirect case addition(ArithmeticExpression, ArithmeticExpression)
+	indirect case multiplication(ArithmeticExpression, ArithmeticExpression)
+}
+\end{swift}
+You can also write indirect before the beginning of the enumeration to enable indirection for all of the enumeration's cases that have an associated value:
+\begin{swift}
+indirect enum ArithmeticExpression {
+	case number(Int)
+	case addition(ArithmeticExpression, ArithmeticExpression)
+	case multiplication(ArithmeticExpression, ArithmeticExpression)
+}
+\end{swift}
+This enumeration can store three kinds of arithmetic expressions: a plain number, the addition of two expressions, and the multiplication of two expressions.
+The addition and multiplication cases have associated values that are also arithmetic expressions -- these associated values make it possible to nest expressions.
+For example, the expression (5 + 4) * 2 has a number on the right-hand side of the multiplication and another expression on the left-hand side of the multiplication.
+Because the data is nested, the enumeration used to store the data also needs to support nesting -- this means the enumeration needs to be recursive.
+The code below shows the ArithmeticExpression recursive enumeration being created for (5 + 4) * 2:
+\begin{swift}
+let five = ArithmeticExpression.number(5)
+let four = ArithmeticExpression.number(4)
+let sum = ArithmeticExpression.addition(five, four)
+let product = ArithmeticExpression.multiplication(sum, ArithmeticExpression.number(2))
+\end{swift}
+A recursive function is a straightforward way to work with data that has a recursive structure.
+For example, here's a function that evaluates an arithmetic expression:
+\begin{swift}
+func evaluate(_ expression: ArithmeticExpression) -> Int {
+	switch expression {
+	case let .number(value):
+		return value
+	case let .addition(left, right):
+		return evaluate(left) + evaluate(right)
+	case let .multiplication(left, right):
+		return evaluate(left) * evaluate(right)
+	}
+}
+
+print(evaluate(product))
+// Prints "18"
+\end{swift}
+This function evaluates a plain number by simply returning the associated value.
+It evaluates an addition or multiplication by evaluating the expression on the left-hand side, evaluating the expression on the right-hand side, and then adding them or multiplying them.
+
+
 \section{Python}
 
