Added dot-pair type

This commit is contained in:
Erin 2022-08-05 23:59:13 +02:00 committed by ondra05
parent 35676865b0
commit e92e1e3f7c
2 changed files with 8 additions and 1 deletions

View file

@ -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<f64>;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Value<'s> {
List(/* TODO: List impl (or dotted pair) */),
DotPair(Rc<DotPair<'s>>),
Vector(Rc<Vec<Self>>),
Map(Rc<BTreeMap<Self, Self>>),
Symbol(Str<'s>),
@ -19,4 +21,5 @@ pub enum Value<'s> {
String(Str<'s>),
Function(Function),
Macro(Function),
Nil,
}

View file

@ -0,0 +1,4 @@
use super::Value;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DotPair<'s>(pub Value<'s>, pub Value<'s>);