From 57c6323c15e257d4620f9d02a54e704d25bd2084 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sun, 17 Aug 2025 13:19:16 +0300 Subject: fix: repl erroring "let used as operator" with empty/nil inputs this was fixed by transforming empty inputs to nil and not transforming nil inputs to empty inputs. --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 30bd136..d7a2196 100644 --- a/src/main.rs +++ b/src/main.rs @@ -191,13 +191,15 @@ fn repl(mut binds: Vec) -> Result<(), io::Error> { } let orig_expression = match parse_to_ast(&input) { - Ok(SCons(a, b)) if *b == Atom(Nil) => *a, + Ok(SCons(a, b)) if *b == Atom(Nil) && *a != Atom(Nil) => *a, + Ok(Atom(Nil)) => scons(Nil, Nil), Ok(t) => t, Err(e) => { println!("Syntax error: {}", e); continue; }, }; + if let Some((name, _value)) = orig_expression.clone().check_let() { let mut expr = scons(orig_expression.clone(), scons(Nil, Nil)); for i in 1..=binds.len() { -- cgit v1.2.3