Skip to content

Commit

Permalink
Merge pull request #514 from julianjumper/main
Browse files Browse the repository at this point in the history
[#512] set-of instead of set-insert
  • Loading branch information
Alex-Fischman authored Jan 20, 2025
2 parents 56cc61f + ea044fd commit 526869b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sort/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ impl Sort for SetSort {
termdag: &mut TermDag,
) -> Option<(Cost, Term)> {
let set = ValueSet::load(self, &value);
let mut term = termdag.app("set-empty".into(), vec![]);
let mut children = vec![];
let mut cost = 0usize;
for e in set.iter().rev() {
let e = extractor.find_best(*e, termdag, &self.element)?;
cost = cost.saturating_add(e.0);
term = termdag.app("set-insert".into(), vec![term, e.1])
for e in set.iter() {
let (child_cost, child_term) = extractor.find_best(*e, termdag, &self.element)?;
cost = cost.saturating_add(child_cost);
children.push(child_term);
}
Some((cost, term))
Some((cost, termdag.app("set-of".into(), children)))
}

fn serialized_name(&self, _value: &Value) -> Symbol {
Expand Down

0 comments on commit 526869b

Please sign in to comment.