From 7744a82b39bb289809234591e9c727c03685ae38 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 7 Aug 2017 13:13:50 -0700 Subject: Make len a synonym for length. * eval.c (eval_init): Register the same function under length and len. * txr.1: Documented. --- eval.c | 4 +++- txr.1 | 8 +++++++- 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 -- cgit v1.2.3