From 75bffac83e8e8a30ae7643a5d830e580d1ffee65 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Thu, 5 Jan 2023 18:41:13 -0800 Subject: add more primitives --- src/ast.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index faffacd..eefbc45 100644 --- a/src/ast.c +++ b/src/ast.c @@ -84,3 +84,13 @@ void ast_type_print(ast_t *e) { printf("Root Node\n"); } } + +bool is_proper_list(ast_t *e) { + ast_t *cur = e; + while (cur->cdr != NULL) { + cur = cur->cdr; + } + if (cur->type == AST_PAIR && cur->car == NULL) + return true; + return false; +} -- cgit