projects
/
mes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Simplify toplevel read.
[mes.git]
/
lib.c
diff --git
a/lib.c
b/lib.c
index f1cb8e948d52a0e8ff7730cb17d973919e7887ff..b252ef1a014e8cce6b0ccdda49ad874492e93f11 100644
(file)
--- a/
lib.c
+++ b/
lib.c
@@
-56,6
+56,16
@@
list (scm *x) ///((args . n))
return x;
}
return x;
}
+scm *
+list_ref (scm *x, scm *k)
+{
+ assert (x->type == PAIR);
+ assert (k->type == NUMBER);
+ int n = k->value;
+ while (n-- && x->cdr != &scm_nil) x = x->cdr;
+ return x != &scm_nil ? x->car : &scm_undefined;
+}
+
scm *
vector_to_list (scm *v)
{
scm *
vector_to_list (scm *v)
{