diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-10 19:16:51 +0300 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-10 19:16:51 +0300 |
commit | d6d1ec80ffcc0b13234b170a91b920371078a027 (patch) | |
tree | a8347b04ad354e3f2cb265b5d506a4891853cf7f /src/sexp/mod.rs | |
parent | 06798d622327707ca3f3b42d65fc3d1a25ae3c57 (diff) | |
download | myslip-d6d1ec80ffcc0b13234b170a91b920371078a027.tar.gz myslip-d6d1ec80ffcc0b13234b170a91b920371078a027.zip |
Added tests for functions
Diffstat (limited to 'src/sexp/mod.rs')
-rw-r--r-- | src/sexp/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sexp/mod.rs b/src/sexp/mod.rs index 11c185f..4bb4fa2 100644 --- a/src/sexp/mod.rs +++ b/src/sexp/mod.rs @@ -35,6 +35,8 @@ pub enum SLeaf { Let, + Fun, + Ty(Type), Arr, @@ -75,6 +77,7 @@ impl SExp { pub fn is_value(&self) -> bool { match self { SCons(a, b) => + 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()) @@ -102,4 +105,11 @@ impl SExp { _ => false } } + + pub fn is_fun(&self) -> bool { + match self { + SCons(a, _) if **a == Atom(Fun) => true, + _ => false + } + } } |