diff -r 0f6e3c5a1751 -r 6f508bcdaa30 progs/nfa.scala --- 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))