summaryrefslogtreecommitdiff
path: root/libguile/srfi-1.c
diff options
context:
space:
mode:
authorRob Browning <rlb@defaultvalue.org>2024-07-17 22:18:05 -0500
committerRob Browning <rlb@defaultvalue.org>2024-07-30 19:28:37 -0500
commit3eb6afe738b313deac6b43cc4c883f70179f48cc (patch)
treeb76ed3f5539e30f270f55cd020eb9ba9e9d092db /libguile/srfi-1.c
parent925faf1f01106e468dde78c453595575904bc158 (diff)
downloadguile-3eb6afe738b313deac6b43cc4c883f70179f48cc.tar.gz
srfi-1 partition!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_partition_x): delete. * libguile/srfi-1.h (scm_srfi1_partition_x): delete. * module/srfi/srfi-1.scm: add partition!.
Diffstat (limited to 'libguile/srfi-1.c')
-rw-r--r--libguile/srfi-1.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/libguile/srfi-1.c b/libguile/srfi-1.c
index e79492f65..64b4f46ee 100644
--- a/libguile/srfi-1.c
+++ b/libguile/srfi-1.c
@@ -331,59 +331,6 @@ SCM_DEFINE (scm_srfi1_lset_difference_x, "lset-difference!", 2, 0, 1,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_srfi1_partition_x, "partition!", 2, 0, 0,
- (SCM pred, SCM lst),
- "Split @var{lst} into those elements which do and don't satisfy\n"
- "the predicate @var{pred}.\n"
- "\n"
- "The return is two values (@pxref{Multiple Values}), the first\n"
- "being a list of all elements from @var{lst} which satisfy\n"
- "@var{pred}, the second a list of those which do not.\n"
- "\n"
- "The elements in the result lists are in the same order as in\n"
- "@var{lst} but the order in which the calls @code{(@var{pred}\n"
- "elem)} are made on the list elements is unspecified.\n"
- "\n"
- "@var{lst} may be modified to construct the return lists.")
-#define FUNC_NAME s_scm_srfi1_partition_x
-{
- SCM tlst, flst, *tp, *fp;
-
- SCM_ASSERT (scm_is_true (scm_procedure_p (pred)), pred, SCM_ARG1, FUNC_NAME);
-
- /* tlst and flst are the lists of true and false elements. tp and fp are
- where to store to append to them, initially &tlst and &flst, then
- SCM_CDRLOC of the last pair in the respective lists. */
-
- tlst = SCM_EOL;
- flst = SCM_EOL;
- tp = &tlst;
- fp = &flst;
-
- for ( ; scm_is_pair (lst); lst = SCM_CDR (lst))
- {
- if (scm_is_true (scm_call_1 (pred, SCM_CAR (lst))))
- {
- *tp = lst;
- tp = SCM_CDRLOC (lst);
- }
- else
- {
- *fp = lst;
- fp = SCM_CDRLOC (lst);
- }
- }
-
- SCM_ASSERT_TYPE (SCM_NULL_OR_NIL_P (lst), lst, SCM_ARG2, FUNC_NAME, "list");
-
- /* terminate whichever didn't get the last element(s) */
- *tp = SCM_EOL;
- *fp = SCM_EOL;
-
- return scm_values_2 (tlst, flst);
-}
-#undef FUNC_NAME
-
void
scm_register_srfi_1 (void)