diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-06-28 13:34:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-06-28 13:34:53 -0700 |
commit | b39b7e8173e6f2c74b69ee0c5b4c448a154b5078 (patch) | |
tree | 1d22e4ae3e2bb0b3d8514da7c3b9cbc6d2471e2d /lisplib.c | |
parent | 931ee402f18da5c2eeeefb5d6f1217c833e04508 (diff) | |
download | txr-b39b7e8173e6f2c74b69ee0c5b4c448a154b5078.tar.gz txr-b39b7e8173e6f2c74b69ee0c5b4c448a154b5078.tar.bz2 txr-b39b7e8173e6f2c74b69ee0c5b4c448a154b5078.zip |
New producting each operator family.
* lisplib.c (each_prod_instantiate, each_prod_set_entries):
New static functions.
(lisplib_init): Register autoload of each-prod.tl via new
functions.
* share/txr/stdlib/each-prod.tl: New file.
* txr.1: Documented. Also, under the existing collect-each
family of operators, added the equivalence to mapping with
lambda to help clarify the semantics.
Diffstat (limited to 'lisplib.c')
-rw-r--r-- | lisplib.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -821,6 +821,23 @@ static val copy_file_set_entries(val dlt, val fun) return nil; } +static val each_prod_instantiate(val set_fun) +{ + funcall1(set_fun, nil); + load(scat2(stdlib_path, lit("each-prod"))); + return nil; +} + +static val each_prod_set_entries(val dlt, val fun) +{ + val name[] = { + lit("each-prod"), lit("collect-each-prod"), lit("append-each-prod"), + lit("each-prod*"), lit("collect-each-prod*"), lit("append-each-prod*"), + nil + }; + set_dlt_entries(dlt, name, fun); + return nil; +} val dlt_register(val dlt, val (*instantiate)(val), @@ -874,6 +891,7 @@ void lisplib_init(void) dlt_register(dl_table, save_exe_instantiate, save_exe_set_entries); dlt_register(dl_table, defset_instantiate, defset_set_entries); dlt_register(dl_table, copy_file_instantiate, copy_file_set_entries); + dlt_register(dl_table, each_prod_instantiate, each_prod_set_entries); reg_fun(intern(lit("try-load"), system_package), func_n1(lisplib_try_load)); } |