From b554fd4ed035396886c673778d60659085d8b286 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 27 Oct 2014 23:49:11 -0500 Subject: rust: fix quote/quasiquote of vectors. --- rust/src/step7_quote.rs | 6 +++--- rust/src/step8_macros.rs | 6 +++--- rust/src/step9_try.rs | 6 +++--- rust/src/stepA_interop.rs | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'rust/src') diff --git a/rust/src/step7_quote.rs b/rust/src/step7_quote.rs index bdfdf24..a46f548 100644 --- a/rust/src/step7_quote.rs +++ b/rust/src/step7_quote.rs @@ -26,7 +26,7 @@ fn read(str: String) -> MalRet { // eval fn is_pair(x: MalVal) -> bool { match *x { - List(ref lst,_) => lst.len() > 0, + List(ref lst,_) | Vector(ref lst,_) => lst.len() > 0, _ => false, } } @@ -37,7 +37,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } match *ast.clone() { - List(ref args,_) => { + List(ref args,_) | Vector(ref args,_) => { let ref a0 = args[0]; match **a0 { Sym(ref s) => { @@ -50,7 +50,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } if is_pair(a0.clone()) { match **a0 { - List(ref a0args,_) => { + List(ref a0args,_) | Vector(ref a0args,_) => { let a00 = a0args[0].clone(); match *a00 { Sym(ref s) => { diff --git a/rust/src/step8_macros.rs b/rust/src/step8_macros.rs index 3e5f8a7..fbbaf35 100644 --- a/rust/src/step8_macros.rs +++ b/rust/src/step8_macros.rs @@ -26,7 +26,7 @@ fn read(str: String) -> MalRet { // eval fn is_pair(x: MalVal) -> bool { match *x { - List(ref lst,_) => lst.len() > 0, + List(ref lst,_) | Vector(ref lst,_) => lst.len() > 0, _ => false, } } @@ -37,7 +37,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } match *ast.clone() { - List(ref args,_) => { + List(ref args,_) | Vector(ref args,_) => { let ref a0 = args[0]; match **a0 { Sym(ref s) => { @@ -50,7 +50,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } if is_pair(a0.clone()) { match **a0 { - List(ref a0args,_) => { + List(ref a0args,_) | Vector(ref a0args,_) => { let a00 = a0args[0].clone(); match *a00 { Sym(ref s) => { diff --git a/rust/src/step9_try.rs b/rust/src/step9_try.rs index c36abcb..4449661 100644 --- a/rust/src/step9_try.rs +++ b/rust/src/step9_try.rs @@ -26,7 +26,7 @@ fn read(str: String) -> MalRet { // eval fn is_pair(x: MalVal) -> bool { match *x { - List(ref lst,_) => lst.len() > 0, + List(ref lst,_) | Vector(ref lst,_) => lst.len() > 0, _ => false, } } @@ -37,7 +37,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } match *ast.clone() { - List(ref args,_) => { + List(ref args,_) | Vector(ref args,_) => { let ref a0 = args[0]; match **a0 { Sym(ref s) => { @@ -50,7 +50,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } if is_pair(a0.clone()) { match **a0 { - List(ref a0args,_) => { + List(ref a0args,_) | Vector(ref a0args,_) => { let a00 = a0args[0].clone(); match *a00 { Sym(ref s) => { diff --git a/rust/src/stepA_interop.rs b/rust/src/stepA_interop.rs index c36abcb..4449661 100644 --- a/rust/src/stepA_interop.rs +++ b/rust/src/stepA_interop.rs @@ -26,7 +26,7 @@ fn read(str: String) -> MalRet { // eval fn is_pair(x: MalVal) -> bool { match *x { - List(ref lst,_) => lst.len() > 0, + List(ref lst,_) | Vector(ref lst,_) => lst.len() > 0, _ => false, } } @@ -37,7 +37,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } match *ast.clone() { - List(ref args,_) => { + List(ref args,_) | Vector(ref args,_) => { let ref a0 = args[0]; match **a0 { Sym(ref s) => { @@ -50,7 +50,7 @@ fn quasiquote(ast: MalVal) -> MalVal { } if is_pair(a0.clone()) { match **a0 { - List(ref a0args,_) => { + List(ref a0args,_) | Vector(ref a0args,_) => { let a00 = a0args[0].clone(); match *a00 { Sym(ref s) => { -- cgit v1.2.3