summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-02 02:37:17 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-02 02:37:17 -0800
commit256ba9369ab15b1eced9aa81fd1e466e138e2933 (patch)
treec579e25cf5e1cd302755c486c66f742eef853099 /lib.c
parent97b07f495505f5e3b9b0e99e8d024d85eedf0952 (diff)
downloadtxr-256ba9369ab15b1eced9aa81fd1e466e138e2933.tar.gz
txr-256ba9369ab15b1eced9aa81fd1e466e138e2933.tar.bz2
txr-256ba9369ab15b1eced9aa81fd1e466e138e2933.zip
* eval.c (apply): Support string and vector arglist.
(do_eval_args): Support string or vector in dot position. * lib.c (tolist): New function. * lib.h (tolist): Declared. * txr.1: Document how apply and dot position in compound forms supports strings as well as vectors.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index d490a2c1..d2fa0147 100644
--- a/lib.c
+++ b/lib.c
@@ -470,6 +470,23 @@ val to_seq(val seq)
}
}
+val tolist(val seq)
+{
+ switch (type(seq)) {
+ case VEC:
+ return list_vector(seq);
+ case STR:
+ case LIT:
+ case LSTR:
+ return list_str(seq);
+ case NIL:
+ case CONS:
+ case LCONS:
+ default:
+ return seq;
+ }
+}
+
val *list_collect(val *ptail, val obj)
{
switch (type(*ptail)) {