aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-03-23 13:26:13 +0000
committerAkshay <[email protected]>2021-03-23 13:26:13 +0000
commita0fce05399b3ee284b6c60a409fad74c23432ce8 (patch)
treeca661845ee5c4bd60c702d00c6fb68c74ea1837f
parent005156915c9d1d36500b73b9c44d9179aecd8c2f (diff)
macro based primitive implementor
-rw-r--r--src/lisp/primitives.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lisp/primitives.rs b/src/lisp/primitives.rs
new file mode 100644
index 0000000..1c9fe8e
--- /dev/null
+++ b/src/lisp/primitives.rs
@@ -0,0 +1,10 @@
1#[macro_export]
2macro_rules! primitive {
3 ($env:expr, $arity:expr, $name:expr, $closure:expr) => {
4 let val = crate::lisp::expr::LispExpr::PrimitiveFunc(crate::lisp::expr::PrimitiveFunc {
5 arity: $arity,
6 closure: $closure,
7 });
8 let _ = $env.insert($name.to_string(), val);
9 };
10}