aboutsummaryrefslogtreecommitdiff
path: root/src/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp')
-rw-r--r--src/lisp/expr.rs8
-rw-r--r--src/lisp/prelude.rs6
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lisp/expr.rs b/src/lisp/expr.rs
index aeaa2d8..2319601 100644
--- a/src/lisp/expr.rs
+++ b/src/lisp/expr.rs
@@ -254,12 +254,12 @@ impl fmt::Debug for LispExpr {
254 LispExpr::Number(n) => write!(f, "Number({:?})", n), 254 LispExpr::Number(n) => write!(f, "Number({:?})", n),
255 LispExpr::List(l) => { 255 LispExpr::List(l) => {
256 write!(f, "List ")?; 256 write!(f, "List ")?;
257 f.debug_list().entries(l.iter()).finish() 257 f.debug_list().entries(l.iter()).finish()
258 }, 258 }
259 LispExpr::DottedList(l) => { 259 LispExpr::DottedList(l) => {
260 write!(f, "DottedList ")?; 260 write!(f, "DottedList ")?;
261 f.debug_list().entries(l.iter()).finish() 261 f.debug_list().entries(l.iter()).finish()
262 }, 262 }
263 LispExpr::StringLit(s) => write!(f, "String({:?})", s), 263 LispExpr::StringLit(s) => write!(f, "String({:?})", s),
264 LispExpr::Char(c) => write!(f, "Char({:?})", c), 264 LispExpr::Char(c) => write!(f, "Char({:?})", c),
265 LispExpr::BoolLit(b) => write!(f, "Bool({:?})", b), 265 LispExpr::BoolLit(b) => write!(f, "Bool({:?})", b),
diff --git a/src/lisp/prelude.rs b/src/lisp/prelude.rs
index add405c..336dbaf 100644
--- a/src/lisp/prelude.rs
+++ b/src/lisp/prelude.rs
@@ -153,7 +153,9 @@ pub fn new_env() -> Result<Environment, LispError> {
153 (LispExpr::Unit, LispExpr::Unit) => Ok(true), 153 (LispExpr::Unit, LispExpr::Unit) => Ok(true),
154 (LispExpr::Number(s), LispExpr::Number(o)) => Ok(s == o), 154 (LispExpr::Number(s), LispExpr::Number(o)) => Ok(s == o),
155 (LispExpr::List(s), LispExpr::List(o)) => Ok(s.iter().zip(o).all(|(a, b)| a == b)), 155 (LispExpr::List(s), LispExpr::List(o)) => Ok(s.iter().zip(o).all(|(a, b)| a == b)),
156 (LispExpr::DottedList(s), LispExpr::DottedList(o)) => Ok(s.iter().zip(o).all(|(a, b)| a == b)), 156 (LispExpr::DottedList(s), LispExpr::DottedList(o)) => {
157 Ok(s.iter().zip(o).all(|(a, b)| a == b))
158 }
157 (LispExpr::List(s), LispExpr::Unit) => Ok(s.len() == 0), 159 (LispExpr::List(s), LispExpr::Unit) => Ok(s.len() == 0),
158 (LispExpr::Unit, LispExpr::List(s)) => Ok(s.len() == 0), 160 (LispExpr::Unit, LispExpr::List(s)) => Ok(s.len() == 0),
159 (LispExpr::DottedList(_), LispExpr::Unit) => Ok(false), 161 (LispExpr::DottedList(_), LispExpr::Unit) => Ok(false),
@@ -319,7 +321,7 @@ pub fn new_env() -> Result<Environment, LispError> {
319 ls.remove(0); 321 ls.remove(0);
320 return Ok(LispExpr::List(ls)); 322 return Ok(LispExpr::List(ls));
321 } 323 }
322 } else if type_match!(args, 0 => LispExpr::DottedList(_)){ 324 } else if type_match!(args, 0 => LispExpr::DottedList(_)) {
323 // cdr of an improper list is an improper list or an atom 325 // cdr of an improper list is an improper list or an atom
324 let ls = args[0].unwrap_dotted_list(); 326 let ls = args[0].unwrap_dotted_list();
325 if ls.len() == 2 { 327 if ls.len() == 2 {