aboutsummaryrefslogtreecommitdiff
path: root/rust/src/types.rs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-10-27 23:20:22 -0500
committerJoel Martin <github@martintribe.org>2015-01-06 21:59:01 -0600
commit77b2da6cf337bbd85914619bfbccba69b6621a04 (patch)
treeafa9bcca8e965363962d585f312cb76eb14f8183 /rust/src/types.rs
parentbd3067230dcbd18fb1f0db7abb52c4ea1c2e227b (diff)
downloadmal-77b2da6cf337bbd85914619bfbccba69b6621a04.tar.gz
mal-77b2da6cf337bbd85914619bfbccba69b6621a04.zip
rust: add conj, stepA. Self-hosting!
Diffstat (limited to 'rust/src/types.rs')
-rw-r--r--rust/src/types.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs
index e7e60f9..0b59716 100644
--- a/rust/src/types.rs
+++ b/rust/src/types.rs
@@ -247,7 +247,7 @@ pub fn vector_q(a:Vec<MalVal>) -> MalRet {
}
match *a[0].clone() {
Vector(_,_) => Ok(_true()),
- _ => Ok(_false()),
+ _ => Ok(_false()),
}
}
@@ -330,6 +330,15 @@ pub fn malfuncd(mfd: MalFuncData, meta: MalVal) -> MalVal {
// Atoms
+pub fn atom_q(a:Vec<MalVal>) -> MalRet {
+ if a.len() != 1 {
+ return err_str("Wrong arity to atom? call");
+ }
+ match *a[0].clone() {
+ Atom(_) => Ok(_true()),
+ _ => Ok(_false()),
+ }
+}
pub fn atom(a:Vec<MalVal>) -> MalRet {
if a.len() != 1 {
return err_str("Wrong arity to atom call");
@@ -345,6 +354,6 @@ pub fn sequential_q(a:Vec<MalVal>) -> MalRet {
}
match *a[0].clone() {
List(_,_) | Vector(_,_) => Ok(_true()),
- _ => Ok(_false()),
+ _ => Ok(_false()),
}
}