Added dot-pair type
This commit is contained in:
parent
35676865b0
commit
e92e1e3f7c
|
@ -1,7 +1,9 @@
|
||||||
mod function;
|
mod function;
|
||||||
|
mod pair;
|
||||||
mod string;
|
mod string;
|
||||||
|
|
||||||
pub use function::Function;
|
pub use function::Function;
|
||||||
|
pub use pair::DotPair;
|
||||||
pub use string::Str;
|
pub use string::Str;
|
||||||
|
|
||||||
use std::{collections::BTreeMap, rc::Rc};
|
use std::{collections::BTreeMap, rc::Rc};
|
||||||
|
@ -10,7 +12,7 @@ pub type OrderedF64 = ordered_float::OrderedFloat<f64>;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum Value<'s> {
|
pub enum Value<'s> {
|
||||||
List(/* TODO: List impl (or dotted pair) */),
|
DotPair(Rc<DotPair<'s>>),
|
||||||
Vector(Rc<Vec<Self>>),
|
Vector(Rc<Vec<Self>>),
|
||||||
Map(Rc<BTreeMap<Self, Self>>),
|
Map(Rc<BTreeMap<Self, Self>>),
|
||||||
Symbol(Str<'s>),
|
Symbol(Str<'s>),
|
||||||
|
@ -19,4 +21,5 @@ pub enum Value<'s> {
|
||||||
String(Str<'s>),
|
String(Str<'s>),
|
||||||
Function(Function),
|
Function(Function),
|
||||||
Macro(Function),
|
Macro(Function),
|
||||||
|
Nil,
|
||||||
}
|
}
|
||||||
|
|
4
src/interpreter/value/pair.rs
Normal file
4
src/interpreter/value/pair.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
use super::Value;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
|
pub struct DotPair<'s>(pub Value<'s>, pub Value<'s>);
|
Loading…
Reference in a new issue