From d1c97e405230b6616ef834cf38be351e566a228e Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Thu, 21 Aug 2025 12:35:37 +0300 Subject: feat: implemented coproducts according to tests --- src/sexp/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/sexp/mod.rs') diff --git a/src/sexp/mod.rs b/src/sexp/mod.rs index 14731dd..c1a5a8e 100644 --- a/src/sexp/mod.rs +++ b/src/sexp/mod.rs @@ -89,7 +89,10 @@ impl SExp { scons(a.clone(), b.clone()).is_fun() || SCons(a.clone(), b.clone()).check_let().is_some() || ( - (**a == Atom(Quote) || **a == Atom(Vector) || (**a).is_type_lit()) + (**a == Atom(Quote) + || **a == Atom(Vector) + || (**a).is_type_lit() + || **a == Atom(Coprod)) && b.consists_of_values() ), Atom(Var(_)) => false, @@ -122,4 +125,11 @@ impl SExp { _ => false } } + + pub fn is_type_atom(&self) -> bool { + match self { + Atom(Ty(_)) => true, + _ => false, + } + } } -- cgit v1.2.3