diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-08-14 22:38:26 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-08-14 22:38:26 -0700 |
commit | f283c37f4ead35b39f6cff2cf0156af95a8d4376 (patch) | |
tree | 9353be2b6df9f920d25f73f47c566d4dc86d172a | |
parent | 3a905766e6ed9fac09e14a1d618395670062c98d (diff) | |
download | txr-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.c | 7 | ||||
-rw-r--r-- | txr.1 | 9 |
2 files changed, 14 insertions, 2 deletions
@@ -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)); @@ -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 |