From 2489bf56dcc2a9ba4733550f88a8dc59ae2a131a Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 29 Nov 2024 21:59:33 -0600 Subject: [PATCH] adding conversions for symbols and keywords to strings --- src/types.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/types.rs b/src/types.rs index 481dfdc..41ba975 100644 --- a/src/types.rs +++ b/src/types.rs @@ -49,6 +49,13 @@ impl Value { _ => Err(miette!("No function here, shouldn't call apply")), } } + + pub fn is_list(&self) -> bool { + match self { + Self::List(_) => true, + _ => false, + } + } } impl From> for Value { @@ -104,6 +111,8 @@ impl From for String { fn from(value: Value) -> Self { match value { Value::String(str) => str, + Value::Symbol(Symbol(str)) => str, + Value::Keyword(Keyword(str)) => str, _ => String::default(), } } @@ -113,6 +122,8 @@ impl From<&Value> for String { fn from(value: &Value) -> Self { match value { Value::String(str) => str.clone(), + Value::Symbol(Symbol(str)) => str.clone(), + Value::Keyword(Keyword(str)) => str.clone(), _ => String::default(), } }