From 2fed26cfa1f3bdd67b74ee755b63fcec341a6bf1 Mon Sep 17 00:00:00 2001
From: Matt Keeter <matt.j.keeter@gmail.com>
Date: Thu, 1 Jun 2017 09:32:33 -0400
Subject: [PATCH] Add scm_is_list helper function

---
 doc/ref/api-data.texi | 4 ++++
 libguile/list.c       | 5 +++++
 libguile/list.h       | 1 +
 3 files changed, 10 insertions(+)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 7b10d34..5c36ca2 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -5846,6 +5846,10 @@ Return @code{#t} if @var{x} is the empty list, else @code{#f}.
 Return 1 when @var{x} is the empty list; otherwise return 0.
 @end deftypefn
 
+@deftypefn {C Function} int scm_is_list (SCM obj)
+This is equivalent to @code{scm_is_true (scm_list_p (obj))}.
+@end deftypefn
+
 
 @node List Constructors
 @subsubsection List Constructors
diff --git a/libguile/list.c b/libguile/list.c
index 9396315..07ffc5c 100644
--- a/libguile/list.c
+++ b/libguile/list.c
@@ -1001,6 +1001,11 @@ SCM_DEFINE (scm_filter_x, "filter!", 2, 0, 0,
 }
 #undef FUNC_NAME
 
+int
+scm_is_list (SCM t)
+{
+  return scm_is_true (scm_list_p (t));
+}
 
 void
 scm_init_list ()
diff --git a/libguile/list.h b/libguile/list.h
index 238926e..32821d8 100644
--- a/libguile/list.h
+++ b/libguile/list.h
@@ -69,6 +69,7 @@ SCM_API SCM scm_filter (SCM pred, SCM list);
 SCM_API SCM scm_filter_x (SCM pred, SCM list);
 SCM_API SCM scm_copy_tree (SCM obj);
 
+SCM_API int scm_is_list (SCM x);
 
 
 /* Guile internal functions */
-- 
2.9.2

