A categorical programming language
Révision | 97a7a3ed2f25a148e138e7dedb43af9b84a405b4 (tree) |
---|---|
l'heure | 2024-05-24 14:09:14 |
Auteur | Corbin <cds@corb...> |
Commiter | Corbin |
jelly: Fix the problematic rule.
@@ -54,13 +54,6 @@ impl CostFunction<SymbolLang> for CAMCostModel { | ||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -// XXX doesn't typecheck!? | |
58 | -// fn isNotNil<L, N>(var :&'static str) -> impl Fn(&mut EGraph<L, N>, Id, &Subst) -> bool { | |
59 | -// let v = var.parse().unwrap(); | |
60 | -// let nil = "nil".parse().unwrap(); | |
61 | -// move |egraph, _, subst| !egraph[subst[v]].nodes.contains(&nil) | |
62 | -// } | |
63 | - | |
64 | 57 | // Hagino 1987: https://web.sfc.keio.ac.jp/~hagino/index.html.en |
65 | 58 | // Cousineau, Curien, & Mauny 1987: https://doi.org/10.1016/0167-6423(87)90020-7 |
66 | 59 | // Wadler 1989: https://www2.cs.sfu.ca/CourseCentral/831/burton/Notes/July14/free.pdf |
@@ -129,8 +122,7 @@ fn main() -> std::io::Result<()> { | ||
129 | 122 | // pair-precompose when ?g is id |
130 | 123 | rw!("pair-factor-snd"; "(pair (comp ?r ?f) ?r)" => "(comp ?r (pair ?f id))"), |
131 | 124 | // pair-precompose when ?f and ?g are id |
132 | - // XXX This is not type-correct when ?r is nil. | |
133 | - rw!("pair-factor-both"; "(pair ?r ?r)" => "(comp ?r dup)"), // if isNotNil("?r")), | |
125 | + rw!("pair-factor-both"; "(comp ?r dup)" => "(pair ?r ?r)"), | |
134 | 126 | |
135 | 127 | // jet for pair/dup |
136 | 128 | rw!("pair-dup-jet"; "(pair id id)" => "dup"), |