diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-05 06:20:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-05 06:20:08 -0700 |
commit | 7f7379793f4732b09350798c22d9ed22dd2f11ba (patch) | |
tree | de85d0c9cf8927395b3bb64b38272b261d6a8c4a /eval.c | |
parent | c17054aa390ce42e867d9ce7b5fd821e0c666d45 (diff) | |
download | txr-7f7379793f4732b09350798c22d9ed22dd2f11ba.tar.gz txr-7f7379793f4732b09350798c22d9ed22dd2f11ba.tar.bz2 txr-7f7379793f4732b09350798c22d9ed22dd2f11ba.zip |
New functions take, drop, {take,drop}-{while,until}.
* lib.c (take_list_fun, take_while_list_fun,
take_until_list_fun): New static functions.
(take, take_while, take_until, drop, drop_while,
drop_until): New functions.
* eval.c (eval_init): Register intrinsics take,
take-while, take-until, drop, drop-while, drop-until.
* txr.1: Documented.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -4323,6 +4323,12 @@ void eval_init(void) reg_fun(intern(lit("clamp"), user_package), func_n3(clamp)); reg_fun(intern(lit("pos-max"), user_package), func_n3o(pos_max, 1)); reg_fun(intern(lit("pos-min"), user_package), func_n3o(pos_min, 1)); + reg_fun(intern(lit("take"), user_package), func_n2(take)); + reg_fun(intern(lit("take-while"), user_package), func_n3o(take_while, 2)); + reg_fun(intern(lit("take-until"), user_package), func_n3o(take_until, 2)); + reg_fun(intern(lit("drop"), user_package), func_n2(drop)); + reg_fun(intern(lit("drop-while"), user_package), func_n3o(drop_while, 2)); + reg_fun(intern(lit("drop-until"), user_package), func_n3o(drop_until, 2)); reg_fun(intern(lit("in"), user_package), func_n4o(in, 2)); reg_fun(intern(lit("logand"), user_package), func_n0v(logandv)); reg_fun(intern(lit("logior"), user_package), func_n0v(logiorv)); |