[uim-commit] r923 - trunk/uim
tkng at freedesktop.org
tkng at freedesktop.org
Sat Jul 2 21:48:28 PDT 2005
Author: tkng
Date: 2005-07-02 21:48:25 -0700 (Sat, 02 Jul 2005)
New Revision: 923
Modified:
trunk/uim/slib.c
Log:
* uim/slib.c:
- (list_ref): New function for list-ref.
All calling of 'nth' should be replaced with list-ref, because
R5RS nor SRFI don't have the function 'nth'.
Modified: trunk/uim/slib.c
===================================================================
--- trunk/uim/slib.c 2005-07-03 04:39:08 UTC (rev 922)
+++ trunk/uim/slib.c 2005-07-03 04:48:25 UTC (rev 923)
@@ -4517,6 +4517,20 @@
}
static LISP
+list_ref (LISP list, LISP k)
+{
+ LISP l;
+ long j, n = get_c_int (k);
+ for (j = 0, l = list; (j < n) && CONSP (l); ++j)
+ l = CDR (l);
+ if CONSP
+ (l)
+ return (CAR (l));
+ else
+ return (my_err ("bad arg to list-ref", k));
+}
+
+static LISP
llist (LISP l)
{
return (l);
@@ -5055,6 +5069,8 @@
init_subr_2 ("nth", nth);
init_subr_1 ("butlast", butlast);
+ init_subr_2 ("list-ref", list_ref);
+
init_subr_2 ("assv", assv);
init_subr_2 ("strcmp", lstrcmp);
init_subr_2 ("subset", lsubset);
More information about the uim-commit
mailing list