Start working on using a decision tree for when expr. Also fmt fix

This commit is contained in:
microproofs
2024-10-08 13:30:29 -04:00
parent c7ae161a39
commit e8f74985d5
6 changed files with 330 additions and 16 deletions

View File

@@ -232,8 +232,7 @@ fn split(formula: Formula) -> List<Formula> {
fn do_split(f: Formula, fs: List<Formula>) -> List<Formula> {
when f is {
Con(p, q) -> do_split(p, do_split(q, fs))
_ ->
[f, ..fs]
_ -> [f, ..fs]
}
}
@@ -261,14 +260,11 @@ fn tautclause(var: LRVars) -> Bool {
/// insertion of an item into an ordered list
fn insert_ordered(es: List<a>, e: a, compare: fn(a, a) -> Ordering) -> List<a> {
when es is {
[] ->
[e]
[] -> [e]
[head, ..tail] ->
when compare(e, head) is {
Less ->
[e, ..es]
Greater ->
[head, ..insert_ordered(tail, e, compare)]
Less -> [e, ..es]
Greater -> [head, ..insert_ordered(tail, e, compare)]
Equal -> es
}
}

View File

@@ -63,8 +63,7 @@ pub fn descendants(board: ChessSet) -> List<ChessSet> {
|> quicksort(compare_chess_set)
|> list.map(fn(t) { t.2nd })
[_] -> singles
_ ->
[]
_ -> []
}
}
}

View File

@@ -2,8 +2,7 @@ use aiken/collection/list
pub fn quicksort(xs: List<a>, compare: fn(a, a) -> Ordering) -> List<a> {
when xs is {
[] ->
[]
[] -> []
[head, ..tail] -> {
let before =
tail