equal
deleted
inserted
replaced
8 fins: A => Boolean) { // final states |
8 fins: A => Boolean) { // final states |
9 |
9 |
10 // given a state and a character, what is the set of next states? |
10 // given a state and a character, what is the set of next states? |
11 // if there is none => empty set |
11 // if there is none => empty set |
12 def next(q: A, c: C) : Set[A] = |
12 def next(q: A, c: C) : Set[A] = |
13 delta.flatMap(_.lift.apply(q, c)) |
13 delta.flatMap(d => Try(d(q, c)).toOption) |
14 |
14 |
15 def nexts(qs: Set[A], c: C) : Set[A] = |
15 def nexts(qs: Set[A], c: C) : Set[A] = |
16 qs.flatMap(next(_, c)) |
16 qs.flatMap(next(_, c)) |
17 |
17 |
18 def deltas(qs: Set[A], s: List[C]) : Set[A] = s match { |
18 def deltas(qs: Set[A], s: List[C]) : Set[A] = s match { |