From e92e1e3f7cbfc995f930416243fef9555e6d9004 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 5 Aug 2022 23:59:13 +0200 Subject: [PATCH] Added dot-pair type --- src/interpreter/value/mod.rs | 5 ++++- src/interpreter/value/pair.rs | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/interpreter/value/pair.rs diff --git a/src/interpreter/value/mod.rs b/src/interpreter/value/mod.rs index 840ac1d..43d5226 100644 --- a/src/interpreter/value/mod.rs +++ b/src/interpreter/value/mod.rs @@ -1,7 +1,9 @@ mod function; +mod pair; mod string; pub use function::Function; +pub use pair::DotPair; pub use string::Str; use std::{collections::BTreeMap, rc::Rc}; @@ -10,7 +12,7 @@ pub type OrderedF64 = ordered_float::OrderedFloat; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Value<'s> { - List(/* TODO: List impl (or dotted pair) */), + DotPair(Rc>), Vector(Rc>), Map(Rc>), Symbol(Str<'s>), @@ -19,4 +21,5 @@ pub enum Value<'s> { String(Str<'s>), Function(Function), Macro(Function), + Nil, } diff --git a/src/interpreter/value/pair.rs b/src/interpreter/value/pair.rs new file mode 100644 index 0000000..6923cc7 --- /dev/null +++ b/src/interpreter/value/pair.rs @@ -0,0 +1,4 @@ +use super::Value; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct DotPair<'s>(pub Value<'s>, pub Value<'s>);