progs/nfa.scala
changeset 483 faba5360372c
parent 482 74149519e436
child 485 21dec9df46ba
--- 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))