------ Original Message ------
From to...@tuxteam.de
To "Stefan Schmiedl" <s...@xss.de>
Cc guile-user@gnu.org
Date 09.12.2024 15:10:18
Subject Re: sorted?

On Mon, Dec 09, 2024 at 01:54:47PM +0000, Stefan Schmiedl wrote:
 ------ Original Message ------
 > From to...@tuxteam.de
 To guile-user@gnu.org
 Date 09.12.2024 12:42:22
 Subject Re: sorted?

 > On Mon, Dec 09, 2024 at 11:37:33AM +0000, Ricardo G. Herdt wrote:
 > >  Hi Jeremy,
 > >
 > >  Am 09.12.2024 11:21 schrieb Jeremy Korwin-Zmijowski:
 > >  > The reference says :
 > >  >
 > >  >    Scheme Procedure: *sorted?* items less
 > >  >    C Function: *scm_sorted_p* (items, less)
 > >  >
 > >  >        Return |#t| if items is a list or vector such that, for each
 > >  >        element x and the next element y of items, |(less y x)| returns
 > >  >        |#f|. Otherwise return |#f|.
 > >  >
 > >  > I think the description should be :
 > >  >
 > >  >    Return |#t| if items is a list or vector such that, for each element
 > >  >    x and the next element y of items, |(less y x)| returns |#t|.
 > >  >    Otherwise return |#f|.
 > >
 > >  Actually no, since less is applied to y and x in that order. This way
 > >  (sorted? '(1 1) <) correctly returns #t as your experiments show.
 >
 > I don't get it. (< 1 1) is /always/ #f, regardless of the order of the
 > ones?
 >
 > I'm as confused as Jeremy is.
 >

 I understand the reference text as "Return #t if the list is _not
 unsorted_".
 Since (< 1 1) returns #f, '(1 1) is _not unsorted_ and all is well.

This seems the intention. But since it accepts an arbitrary "less"
function, it ends being iffy. How do you go from some "less" to a
"less-or-equal" without running into undecidability dark alleys?

Well, the iffyness is managed by the programmer, who chooses the
comparison function.

Do you have an example of such an iffy set?

s.


          • Re: so... Mikael Djurfeldt
            • R... Mikael Djurfeldt
              • ... Jeremy Korwin-Zmijowski
            • R... tomas
              • ... Mikael Djurfeldt
              • ... Mikael Djurfeldt
              • ... tomas
              • ... Mikael Djurfeldt
      • Re[2]: sorted? Stefan Schmiedl
        • Re: sorted... tomas
          • Re[2]:... Stefan Schmiedl
            • R... tomas
              • ... Mikael Djurfeldt
              • ... Mikael Djurfeldt
              • ... tomas
              • ... Mikael Djurfeldt
              • ... Maxime Devos via General Guile related discussions
              • ... Maxime Devos via General Guile related discussions
          • RE: so... Maxime Devos via General Guile related discussions
      • RE: sorted? Maxime Devos via General Guile related discussions
  • RE: sorted? Maxime Devos via General Guile related discussions

Reply via email to