From 87626d48be8c54b4aa53cb4829ff1c3fc34eb02e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 20 Nov 2014 19:24:45 -0800 Subject: * lib.c (where): Argument order reversed, with compat support. * lib.h (where): Declaration updated. * txr.1: Documented. --- ChangeLog | 8 ++++++++ lib.c | 8 +++++++- lib.h | 2 +- txr.1 | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 720e9371..dc9fa90c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-11-20 Kaz Kylheku + + * lib.c (where): Argument order reversed, with compat support. + + * lib.h (where): Declaration updated. + + * txr.1: Documented. + 2014-11-20 Kaz Kylheku * lib.c (sel): Accept a function in place of the index list. diff --git a/lib.c b/lib.c index c4e6395f..7c65876c 100644 --- a/lib.c +++ b/lib.c @@ -6180,10 +6180,16 @@ val search(val seq, val key, val testfun, val keyfun) return seq; } -val where(val seq_in, val func) +val where(val func, val seq_in) { list_collect_decl (out, ptail); + if (opt_compat && opt_compat <= 100) { + val f = seq_in, s = func; + func = s; + seq_in = f; + } + if (hashp(seq_in)) { val hiter = hash_begin(seq_in); val cell; diff --git a/lib.h b/lib.h index fafad0cf..c4c2d5ff 100644 --- a/lib.h +++ b/lib.h @@ -810,7 +810,7 @@ val refset(val seq, val ind, val newval); val replace(val seq, val items, val from, val to); val update(val seq, val fun); val search(val seq, val key, val from, val to); -val where(val seq, val func); +val where(val func, val seq); val sel(val seq, val where); val env(void); val obj_print(val obj, val stream); diff --git a/txr.1 b/txr.1 index 7b4d85fe..001f7b00 100644 --- a/txr.1 +++ b/txr.1 @@ -13278,7 +13278,7 @@ the resulting value is used in its place. .coNP Function @ where .synb -.mets (where < object << function ) +.mets (where < function << object ) .syne .desc @@ -26079,6 +26079,10 @@ individual characters as if by calling .codn list-str . This behavior changed to the currently documented behavior starting in \*(TX 101. +Also, the arguments of the +.code where +function, which introduced in \*(TX 91, were reversed starting +in \*(TX 101. .IP 99 Up to \*(TX 99, the substitution of TXR Lisp expressions in -- cgit v1.2.3