summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-11 16:42:33 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-11 16:42:33 -0800
commit15dda4428072bb741d6bf42fa4906b217fc2aeb1 (patch)
tree56e8975170bac4dbf3c5cfa526b59667066732eb /lib.c
parent8910536efaa12182a4ae0158783a1bb1426cdf04 (diff)
downloadtxr-15dda4428072bb741d6bf42fa4906b217fc2aeb1.tar.gz
txr-15dda4428072bb741d6bf42fa4906b217fc2aeb1.tar.bz2
txr-15dda4428072bb741d6bf42fa4906b217fc2aeb1.zip
* eval.c (eval_init): Turn a require argument into an optional
one for the functions some, all and none. * lib.c (some_satisfy, all_satisfy, none_satisfy): Add defaulting behavior for pred parameter. * txr.1: Document that the predicate function is optional in calls to some, all and none.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 67784f4d..1b0199c2 100644
--- a/lib.c
+++ b/lib.c
@@ -1038,6 +1038,7 @@ val count_if(val pred, val list, val key)
val some_satisfy(val list, val pred, val key)
{
+ pred = default_arg(key, identity_f);
key = default_arg(key, identity_f);
for (; list; list = cdr(list)) {
@@ -1053,6 +1054,7 @@ val all_satisfy(val list, val pred, val key)
{
val item = t;
+ pred = default_arg(key, identity_f);
key = default_arg(key, identity_f);
for (; list; list = cdr(list)) {
@@ -1065,6 +1067,7 @@ val all_satisfy(val list, val pred, val key)
val none_satisfy(val list, val pred, val key)
{
+ pred = default_arg(key, identity_f);
key = default_arg(key, identity_f);
for (; list; list = cdr(list)) {