diff options
author | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-05 18:07:50 +0300 |
---|---|---|
committer | Joel Kronqvist <joel.kronqvist@iki.fi> | 2025-08-05 18:07:50 +0300 |
commit | d64165e9e6af92bfe350e5d2cc46545b28dbb5c0 (patch) | |
tree | d7a6abb03a83ad08194b94db7b82a6c5f32b4819 /src/sexp/step.rs | |
parent | 1e712e91edea0735c5eb440af26ac6d4454e70a9 (diff) | |
download | myslip-d64165e9e6af92bfe350e5d2cc46545b28dbb5c0.tar.gz myslip-d64165e9e6af92bfe350e5d2cc46545b28dbb5c0.zip |
Added vectors and tests for their evaluation and typing
Diffstat (limited to 'src/sexp/step.rs')
-rw-r--r-- | src/sexp/step.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sexp/step.rs b/src/sexp/step.rs index d66b1bd..535b183 100644 --- a/src/sexp/step.rs +++ b/src/sexp/step.rs @@ -220,6 +220,23 @@ impl SExp { /// Ok(scons(Quote, scons(1, scons(2, Nil)))) /// ); /// ``` + /// + /// **Vectors** + /// + /// The same as quotes functionally, but they require + /// the elements to be of the same type. + /// ```rust + /// use myslip::sexp::{SExp::*, SLeaf::*, util::*}; + /// assert_eq!( + /// scons(Vector, scons(1, scons(2, Nil))).step(), + /// Ok(scons(Vector, scons(1, scons(2, Nil)))) + /// ); + /// assert_eq!( + /// scons(Vector, scons( + /// scons(Sub, scons(2, scons(1, Nil))), + /// scons(2, Nil))).step(), + /// Ok(scons(Vector, scons(1, scons(2, Nil)))) + /// ); pub fn step(self) -> Result<Self, String> { match self { |