Subject: bug#11262: closed (Re: bug#11262: help text fro sorted? predicate is wrong/misleading.)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 22 Apr 2012 12:55:03 +0000

Your bug report

#11262: help text fro sorted? predicate is wrong/misleading.

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
11262: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11262
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#11262: help text fro sorted? predicate is wrong/misleading.
From: [email-masked] (Ludovic Courtès)
To: Alexei Matveev <[email-masked]>
Cc: Ian Hulin <[email-masked]>, Noah Lavine <[email-masked]>, [email-masked]
Date: Sun, 22 Apr 2012 14:53:56 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Alexei,

Alexei Matveev <[email-masked]> skribis:

>>> How about this:
>>>
>>> Return @code{#t} iff @var{items} is a list or vector such that, for
>>> each element @var{x} and the next element @var{y} of @var{items},
>>> @code{(@var{less} @var{x} @var{y})} returns @code{#f}.
>>>
>>> This avoids use of ‘m’, which would need to be defined, and makes
>>> it clear what “comparing element i to the preceeding element”
>>> means.
>
> Yes, "m" should not be mentioned. But I think you got it backwards again:
>
> Return @code{#t} iff @var{items} is a list or vector such that, for
> each element @var{x} and the next element @var{y} of @var{items},
> @code{(@var{less} @var{y} @var{x})} returns @code{#f}.
>
> Note the order of x and y in (less? y x) in the last line.

Oops, indeed.

Pushed in commit fd07759b7d4c9d631090b04855ab81b6a2109e9e.

Thanks for the report, patch, and review!

Ludo’.

Subject: help text fro sorted? predicate is wrong/misleading.
From: Alexei Matveev <[email-masked]>
To: [email-masked]
Date: Tue, 17 Apr 2012 12:07:56 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi, Guilers,

I seem to have almost convinced at least one another person that
the docstring of sorted? predicate is at least misleading:

guile> (sorted? '(0 0) <)
#t

guile> (help sorted?)
`sorted?' is a primitive procedure in the (guile) module.

 -- Scheme Procedure: sorted? items less
     Return `#t' iff ITEMS is a list or a vector such that for all 1 <=
     i <= m, the predicate LESS returns true when applied to all
     elements i - 1 and i

My suggestion for the docstring is below (feel free to improve my broken
english).

Alexei

diff --git a/libguile/sort.c b/libguile/sort.c
index ecadd82..b71d101 100644
--- a/libguile/sort.c
+++ b/libguile/sort.c
@@ -101,9 +101,10 @@ SCM_DEFINE (scm_restricted_vector_sort_x,
"restricted-vector-sort!", 4, 0, 0,
  * (not (less? (list-ref list i) (list-ref list (- i 1)))). */
 SCM_DEFINE (scm_sorted_p, "sorted?", 2, 0, 0,
             (SCM items, SCM less),
-           "Return @code{#t} iff @var{items} is a list or a vector such that\n"
-           "for all 1 <= i <= m, the predicate @var{less} returns true when\n"
-           "applied to all elements i - 1 and i")
+           "Return @code{#t} iff @var{items} is  a list or a vector such\n"
+           "that for all  1 <= i <= m,  the predicate @var{less} returns\n"
+           "@code{#f} when comparing element i to the preceeding element\n"
+           "i - 1.")
 #define FUNC_NAME s_scm_sorted_p
 {
   long len, j;                 /* list/vector length, temp j */