From e35522189f5217987bc455d70c3b9056541ef8c6 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 16 Aug 2025 02:04:09 +0300 Subject: feat: type conversion from (Vec/Quote X) -> X and add vec/quote to rest pattern substitutions --- src/type/util.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/type/util.rs') diff --git a/src/type/util.rs b/src/type/util.rs index ad85b79..d95629d 100644 --- a/src/type/util.rs +++ b/src/type/util.rs @@ -14,6 +14,19 @@ pub fn vecof(ty: impl Into>) -> Type { VecOf(ty.into()) } +impl Type { + pub fn is_quoted_or_vectored_list(&self) -> bool { + match self { + List(v) => match v.get(0) { + Some(VecType) => true, + Some(QuoteTy) => true, + _ => false, + }, + _ => false, + } + } +} + use crate::sexp::{SExp::*, SLeaf::*}; impl SExp { pub fn get_fun_type(self, mut ctx: HashMap) -> Result { -- cgit v1.2.3