[uim-commit] r925 - trunk/uim

tkng at freedesktop.org tkng at freedesktop.org
Sat Jul 2 22:03:29 PDT 2005


Author: tkng
Date: 2005-07-02 22:03:25 -0700 (Sat, 02 Jul 2005)
New Revision: 925

Modified:
   trunk/uim/slib.c
Log:
* uim/slib.c:
 - (list_tail): New R5RS function. nthcdr should be replaced with this function.

Modified: trunk/uim/slib.c
===================================================================
--- trunk/uim/slib.c	2005-07-03 04:55:53 UTC (rev 924)
+++ trunk/uim/slib.c	2005-07-03 05:03:25 UTC (rev 925)
@@ -4530,6 +4530,21 @@
     return (my_err ("bad arg to list-ref", k));
 }
 
+static uim_lisp
+list_tail(uim_lisp lst, uim_lisp nth_)
+{
+  int nth = uim_scm_c_int(nth_);
+  int i;
+  for (i = 0; i < nth; i++) {
+    if (uim_scm_nullp(lst)) {
+      /* something bad happened */
+      return uim_scm_f();
+    }
+    lst = uim_scm_cdr(lst);
+  }
+  return lst;
+}
+
 static LISP
 llist (LISP l)
 {
@@ -5070,6 +5085,7 @@
   init_subr_1 ("butlast", butlast);
 
   init_subr_2 ("list-ref", list_ref);
+  init_subr_2 ("list-tail", list_tail);
 
   init_subr_2 ("assv", assv);
   init_subr_2 ("strcmp", lstrcmp);



More information about the uim-commit mailing list