diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sexp/step.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/sexp/step.rs b/src/sexp/step.rs index 3168c5b..1a336e3 100644 --- a/src/sexp/step.rs +++ b/src/sexp/step.rs @@ -296,7 +296,7 @@ impl SExp { /// let expshould = parse_to_ast("case 3 (3 true) (_ false)"); /// assert_eq!(exp, expshould); /// let exp = exp.and_then(|e| e.step()); - /// assert_eq!(exp, Ok(Atom(True))); + /// assert_eq!(exp, Ok(scons(Atom(True), Nil))); /// /// let exp = "case (coprod Bool (+ 1 2)) ((inl b) (if b 1 0)) ((inr x) (- x 1))"; /// let exp = parse_to_ast(exp); @@ -304,7 +304,7 @@ impl SExp { /// let expshould = parse_to_ast("case (coprod Bool 3) ((inl b) (if b 1 0)) ((inr x) (- x 1))"); /// assert_eq!(exp, expshould); /// let exp = exp.and_then(|e| e.step()); - /// assert_eq!(exp, Ok(scons(Sub, scons(3, scons(1, Nil))))); + /// assert_eq!(exp, parse_to_ast("(- 3 1)")); /// ``` /// /// Shadowing: @@ -371,10 +371,7 @@ impl SExp { SCons(pat, arm) => Ok((*pat, *arm)), _ => Err("unreachable after type checking".to_string()) }?; - let mut arm = match arm { - SCons(x, n) if *n == Atom(Nil) => *x, - t => t, - }; + let mut arm = arm; if let Some(ctx) = scrutinee.matches_pat(&pat) { for (name, value) in ctx { |