brundonsmith / rust_lisp

A Rust-embeddable Lisp, with support for interop with native Rust functions
234 stars 20 forks source link

(* 1 2 3 4) does not evaluate to 24 #21

Closed lasiotus closed 1 year ago

lasiotus commented 1 year ago

This test passes:

#[test]
fn eval_add_list() {
    let result = eval_str("(+ 1 2 3 4)");

    assert_eq!(result, Value::from(Into::<IntType>::into(10)));
}

But this test fails:

#[test]
fn eval_mul_list() {
    let result = eval_str("(* 1 2 3 4)");

    assert_eq!(result, Value::from(Into::<IntType>::into(24)));
}

It seems that (* N1 N2 N3 ...) multiplies only the first two numbers, while (+ N1 N2 ...) adds all of them correctly.

lasiotus commented 1 year ago

Created PR https://github.com/brundonsmith/rust_lisp/pull/24