diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-11-06 06:35:34 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-11-06 06:35:34 -0800 |
commit | 6cd6af985619569e7e12df7b28c6aa1dc10726c1 (patch) | |
tree | f6b64a6bbb70fb630329922a54e470538934876f /lib.c | |
parent | 34cb933b006c52eec59dba4478a0d04c8ae4e5ba (diff) | |
download | txr-6cd6af985619569e7e12df7b28c6aa1dc10726c1.tar.gz txr-6cd6af985619569e7e12df7b28c6aa1dc10726c1.tar.bz2 txr-6cd6af985619569e7e12df7b28c6aa1dc10726c1.zip |
Allow then-func to be omitted in iff. Cleanup.
* eval.c (eval_init): Register iff as requiring only one arg.
* lib.c (do_iff): Do not check thenfun for nil. Just call it.
(iff): Default thenfun to identity.
* txr.1: Documentation updated.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -4606,12 +4606,13 @@ static val do_iff(val env, val args) cons_bind (thenfun, elsefun, choices); return if3(apply(condfun, args, nil), - if2(thenfun, apply(thenfun, args, nil)), + apply(thenfun, args, nil), if2(elsefun, apply(elsefun, args, nil))); } val iff(val condfun, val thenfun, val elsefun) { + thenfun = default_arg(thenfun, identity_f); elsefun = default_bool_arg(elsefun); return func_f0v(cons(condfun, cons(thenfun, elsefun)), do_iff); } |