progs/nfa.scala
changeset 483 6f508bcdaa30
parent 482 0f6e3c5a1751
child 485 bd6d999ab7b6
--- a/progs/nfa.scala	Mon Apr 03 01:10:54 2017 +0800
+++ b/progs/nfa.scala	Tue Apr 11 06:22:46 2017 +0800
@@ -10,7 +10,7 @@
   // given a state and a character, what is the set of next states?
   // if there is none => empty set
   def next(q: A, c: C) : Set[A] = 
-    delta.flatMap(_.lift.apply(q, c))
+    delta.flatMap(d => Try(d(q, c)).toOption)
 
   def nexts(qs: Set[A], c: C) : Set[A] =
     qs.flatMap(next(_, c))