aboutsummaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-10-27 23:49:11 -0500
committerJoel Martin <github@martintribe.org>2015-01-06 21:59:01 -0600
commitb554fd4ed035396886c673778d60659085d8b286 (patch)
tree09c309842066a6122563a725fd801c16732724e9 /rust/src
parent77b2da6cf337bbd85914619bfbccba69b6621a04 (diff)
downloadmal-b554fd4ed035396886c673778d60659085d8b286.tar.gz
mal-b554fd4ed035396886c673778d60659085d8b286.zip
rust: fix quote/quasiquote of vectors.
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/step7_quote.rs6
-rw-r--r--rust/src/step8_macros.rs6
-rw-r--r--rust/src/step9_try.rs6
-rw-r--r--rust/src/stepA_interop.rs6
4 files changed, 12 insertions, 12 deletions
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) => {