--- a/progs/lecture4.scala Fri Nov 30 07:54:49 2018 +0000
+++ b/progs/lecture4.scala Fri Nov 30 08:46:02 2018 +0000
@@ -9,6 +9,21 @@
// length and so on for every type of lists.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
def length_string_list(lst: List[String]): Int = lst match {
case Nil => 0
case x::xs => 1 + length_string_list(xs)
@@ -333,7 +348,7 @@
// Q: Why the kerfuffle about the polymorphic types in DFAs/NFAs?
-// A: Subset construction
+// A: Subset construction.
def subset[A, C](nfa: NFA[A, C]) : DFA[Set[A], C] = {
DFA(nfa.starts,
@@ -405,7 +420,8 @@
case c::Nil => CHAR(c)
case c::s => SEQ(CHAR(c), charlist2rexp(s))
}
-implicit def string2rexp(s: String): Rexp = charlist2rexp(s.toList)
+implicit def string2rexp(s: String): Rexp =
+ charlist2rexp(s.toList)
val r1 = STAR("ab")