summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-08-07 13:13:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-08-07 13:13:50 -0700
commit78ab514b4f3b481ae006821520c6344768a529b3 (patch)
treec817b677932fec7e752ecb242f137c7f15661ba3
parentbde7b8dfe688ce05f445b5ed18f22d6b2a526c3a (diff)
downloadtxr-78ab514b4f3b481ae006821520c6344768a529b3.tar.gz
txr-78ab514b4f3b481ae006821520c6344768a529b3.tar.bz2
txr-78ab514b4f3b481ae006821520c6344768a529b3.zip
Make len a synonym for length.
* eval.c (eval_init): Register the same function under length and len. * txr.1: Documented.
-rw-r--r--eval.c4
-rw-r--r--txr.18
2 files changed, 10 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 76f27fac..765c438c 100644
--- a/eval.c
+++ b/eval.c
@@ -5437,6 +5437,7 @@ void eval_init(void)
val me_each_f = func_n2(me_each);
val me_for_f = func_n2(me_for);
val diff_f = func_n4o(set_diff, 2);
+ val length_f = func_n1(length);
protect(&top_vb, &top_fb, &top_mb, &top_smb, &special, &builtin, &dyn_env,
&op_table, &pm_table, &last_form_evaled, &last_form_expanded,
@@ -6160,7 +6161,8 @@ void eval_init(void)
reg_fun(intern(lit("uni"), user_package), func_n4o(uni, 2));
reg_fun(intern(lit("seqp"), user_package), func_n1(seqp));
- reg_fun(intern(lit("length"), user_package), func_n1(length));
+ reg_fun(intern(lit("length"), user_package), length_f);
+ reg_fun(intern(lit("len"), user_package), length_f);
reg_fun(intern(lit("empty"), user_package), func_n1(empty));
reg_fun(intern(lit("copy"), user_package), func_n1(copy));
reg_fun(intern(lit("sub"), user_package), func_n3o(sub, 1));
diff --git a/txr.1 b/txr.1
index ee896c98..cec90274 100644
--- a/txr.1
+++ b/txr.1
@@ -25391,9 +25391,10 @@ A sequence is defined as a list, vector or string. The object
denotes
the empty list and so is a sequence.
-.coNP Function @ length
+.coNP Functions @ length and @ len
.synb
.mets (length << object )
+.mets (len << object )
.syne
.desc
If
@@ -25403,6 +25404,11 @@ is a sequence, the
function returns the number of items it
contains.
+The
+.code len
+function is a synonym of
+.codn length .
+
The function supports these additional types:
.RS
.coIP hash