--- a/progs/dfa.scala Thu Jul 25 14:39:37 2019 +0100
+++ b/progs/dfa.scala Sun Jul 28 01:00:41 2019 +0100
@@ -1,13 +1,13 @@
// DFAs in Scala using partial functions
import scala.util.Try
-// type abbreviation for partial functions
+// a type abbreviation for partial functions
type :=>[A, B] = PartialFunction[A, B]
-case class DFA[A, C](start: A, // starting state
- delta: (A, C) :=> A, // transition (partial fun)
- fins: A => Boolean) { // final states
+case class DFA[A, C](start: A, // the starting state
+ delta: (A, C) :=> A, // transitions (partial fun)
+ fins: A => Boolean) { // the final states
def deltas(q: A, s: List[C]) : A = s match {
case Nil => q
@@ -52,7 +52,7 @@
case object S2 extends S
case object Sink extends S
-// transition function with a sink state
+// a transition function with a sink state
val sigma : (S, Char) :=> S =
{ case (S0, 'a') => S1
case (S1, 'a') => S2