summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-08-14 22:38:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-08-14 22:38:26 -0700
commitf283c37f4ead35b39f6cff2cf0156af95a8d4376 (patch)
tree9353be2b6df9f920d25f73f47c566d4dc86d172a
parent3a905766e6ed9fac09e14a1d618395670062c98d (diff)
downloadtxr-f283c37f4ead35b39f6cff2cf0156af95a8d4376.tar.gz
txr-f283c37f4ead35b39f6cff2cf0156af95a8d4376.tar.bz2
txr-f283c37f4ead35b39f6cff2cf0156af95a8d4376.zip
mapcar: introduce map as a synonym.
* eval.c (eval_init): Bind new map symbol to the same function as mapcar. * txr.1: Documented.
-rw-r--r--eval.c7
-rw-r--r--txr.19
2 files changed, 14 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index c1bb2c51..422f903f 100644
--- a/eval.c
+++ b/eval.c
@@ -7354,7 +7354,12 @@ void eval_init(void)
reg_fun(intern(lit("length-list"), user_package), func_n1(length_list));
reg_fun(intern(lit("length-list-<"), user_package), func_n2(length_list_lt));
- reg_fun(intern(lit("mapcar"), user_package), func_n1v(mapcarv));
+ {
+ val mapcar_f = func_n1v(mapcarv);
+ reg_fun(intern(lit("mapcar"), user_package), mapcar_f);
+ reg_fun(intern(lit("map"), user_package), mapcar_f);
+ }
+
reg_fun(intern(lit("mapcar*"), user_package), func_n1v(lazy_mapcarv));
reg_fun(intern(lit("mappend"), user_package), func_n1v(mappendv));
reg_fun(intern(lit("mappend*"), user_package), func_n1v(lazy_mappendv));
diff --git a/txr.1 b/txr.1
index b37d799b..277673c7 100644
--- a/txr.1
+++ b/txr.1
@@ -38119,9 +38119,10 @@ and
.code hash-diff
should be used instead.
-.coNP Functions @, mapcar @, mappend @ mapcar* and @ mappend*
+.coNP Functions @, mapcar @, map @, mappend @ mapcar* and @ mappend*
.synb
.mets (mapcar < function << iterable *)
+.mets (map < function << iterable *)
.mets (mappend < function << iterable *)
.mets (mapcar* < function << iterable *)
.mets (mappend* < function << iterable *)
@@ -38161,6 +38162,12 @@ returned. The returned sequence is of the same kind as the leftmost
input sequence, unless the accumulated values cannot be elements of that type of
sequence, in which case a list is returned.
+The functions
+.code mapcar
+and
+.code map
+are synonyms.
+
The
.code mappend
function works like