diff --git a/CHANGELOG.md b/CHANGELOG.md index ad30d94ff..5c9518590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Fix lisp cond expand (#501) - Update rust version (#495) - Fix lisp range params (#494) - Fix lisp comments (#493) diff --git a/src/usr/lisp/expand.rs b/src/usr/lisp/expand.rs index 625712673..e8a3d800a 100644 --- a/src/usr/lisp/expand.rs +++ b/src/usr/lisp/expand.rs @@ -108,7 +108,9 @@ pub fn expand(exp: &Exp, env: &mut Rc>) -> Result { ensure_length_gt!(list, 1); if let Exp::List(args) = &list[1] { ensure_length_eq!(args, 2); - let mut res = vec![Exp::Sym("if".to_string()), args[0].clone(), args[1].clone()]; + let test_exp = expand(&args[0], env)?; + let then_exp = expand(&args[1], env)?; + let mut res = vec![Exp::Sym("if".to_string()), test_exp, then_exp]; if list.len() > 2 { let mut acc = vec![Exp::Sym("cond".to_string())]; acc.extend_from_slice(&list[2..]);