Skip to content

Commit

Permalink
Fix lisp cond expand (#501)
Browse files Browse the repository at this point in the history
* Fix lisp cond expand

* Update changelog
  • Loading branch information
vinc authored Jun 14, 2023
1 parent 9158bd7 commit 0632631
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Fix lisp cond expand (#501)
- Update rust version (#495)
- Fix lisp range params (#494)
- Fix lisp comments (#493)
Expand Down
4 changes: 3 additions & 1 deletion src/usr/lisp/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ pub fn expand(exp: &Exp, env: &mut Rc<RefCell<Env>>) -> Result<Exp, Err> {
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..]);
Expand Down

0 comments on commit 0632631

Please sign in to comment.