Skip to content

Commit

Permalink
Added more cases for rbe
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Jul 17, 2023
1 parent 1366f60 commit 0f531df
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bag/src/rbe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ enum Rbe<A> {

type NullableResult = bool;

impl <A> Rbe<A> where A: Eq {
impl <A> Rbe<A>
where A: Eq + Hash + Clone {


fn derivBag(&self, bag: Bag<A>, open: bool) -> Rbe<A> {
todo!()
fn deriv_bag(&self, bag: Bag<A>, open: bool, controlled: &HashSet<A>) -> Rbe<A> {
let mut current = (*self).clone();
for (x, card) in bag.iter() {
current = self.deriv(&x, card, open, controlled);
}
current
}

fn nullable(&self) -> NullableResult {
Expand Down Expand Up @@ -60,7 +64,7 @@ impl <A> Rbe<A> where A: Eq {
}
}

fn deriv(&self, x: &A, open: bool, controlled: &HashSet<A>) -> Rbe<A>
fn deriv(&self, x: &A, n: usize, open: bool, controlled: &HashSet<A>) -> Rbe<A>
where A: Eq + Hash + Clone {
match &self {
fail@ Rbe::Fail { error: _ } => { (*fail).clone() },
Expand Down

0 comments on commit 0f531df

Please sign in to comment.