Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 11:37:33AM +, 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 i

Re: sorted?

2024-12-09 Thread Ricardo G. Herdt
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, |(les

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 12:43 PM wrote: > On Mon, Dec 09, 2024 at 11:37:33AM +, 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_

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 01:20:48PM +0100, Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 12:43 PM wrote: > > > On Mon, Dec 09, 2024 at 11:37:33AM +, Ricardo G. Herdt wrote: > > > Hi Jeremy, > > > > > > Am 09.12.2024 11:21 schrieb Jeremy Korwin-Zmijowski: > > > > The reference says : > > > >

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 1:37 PM wrote: > On Mon, Dec 09, 2024 at 01:20:48PM +0100, Mikael Djurfeldt wrote: > > On Mon, Dec 9, 2024 at 12:43 PM wrote: > > > > > On Mon, Dec 09, 2024 at 11:37:33AM +, Ricardo G. Herdt wrote: > > > > Hi Jeremy, > > > > > > > > Am 09.12.2024 11:21 schrieb Jeremy K

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 1:58 PM Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 1:37 PM wrote: > >> On Mon, Dec 09, 2024 at 01:20:48PM +0100, Mikael Djurfeldt wrote: >> > On Mon, Dec 9, 2024 at 12:43 PM wrote: >> > >> > > On Mon, Dec 09, 2024 at 11:37:33AM +, Ricardo G. Herdt wrote: >> > >

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 01:58:08PM +0100, Mikael Djurfeldt wrote: [...] > No problem---I'm too. > > Think about it this way: > > How would you sort this list of numbers: 7 1 3 8 2 1 4 ? > > It's 1 1 2 3 4 7 8, right? That is what we want (sort '(7 1 3 8 2 1 4)) to > output (+ the parentheses o

Re: sorted?

2024-12-09 Thread Jeremy Korwin-Zmijowski
No problem---I'm too. Think about it this way: How would you sort this list of numbers: 7 1 3 8 2 1 4 ? It's 1 1 2 3 4 7 8, right? That is what we want (sort '(7 1 3 8 2 1 4)) to output (+ the parentheses of course). Now, `sorted?' returns true if its input is what `sort' would have produced a

sorted?

2024-12-09 Thread Jeremy Korwin-Zmijowski
Hi Guilers, Doing Advent of Code 2024, I was trying to use `sorted?` procedure. And something bothered me. 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 el

Re[2]: sorted?

2024-12-09 Thread Stefan Schmiedl
-- 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 +, Ricardo G. Herdt wrote: Hi Jeremy, Am 09.12.2024 11:21 schrieb Jeremy Korwin-Zmijowski: > The reference says : > >Scheme

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 01:54:47PM +, 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 +, Ricardo G. Herdt wrote: > > > Hi Jeremy, > > > > >

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 07:32:09PM +0100, Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 2:11 PM wrote: > > > On Mon, Dec 09, 2024 at 01:58:08PM +0100, Mikael Djurfeldt wrote: > > > > [...] > > > > > No problem---I'm too. > > > > > > Think about it this way: > > > > > > How would you sort this

Re[2]: sorted?

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

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 07:14:10PM +, Stefan Schmiedl wrote: > -- Original Message -- > > From to...@tuxteam.de [...] > > 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" withou

GNU Shepherd 1.0.0 released

2024-12-09 Thread Ludovic Courtès
We are thrilled to announce version 1.0.0 of the Shepherd, no less than twenty-one years after its initial alpha release! We believe Shepherd has become a solid tool, meeting the kind of user experience one has come to expect since systemd. Check out the web site to learn more: https://gnu.org

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 2:11 PM wrote: > On Mon, Dec 09, 2024 at 01:58:08PM +0100, Mikael Djurfeldt wrote: > > [...] > > > No problem---I'm too. > > > > Think about it this way: > > > > How would you sort this list of numbers: 7 1 3 8 2 1 4 ? > > > > It's 1 1 2 3 4 7 8, right? That is what we want

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
("two kinds of sort") On Mon, Dec 9, 2024 at 7:32 PM Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 2:11 PM wrote: > >> On Mon, Dec 09, 2024 at 01:58:08PM +0100, Mikael Djurfeldt wrote: >> >> [...] >> >> > No problem---I'm too. >> > >> > Think about it this way: >> > >> > How would you sort t

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 7:59 PM wrote: > > (= a b) is equivalent to (not (or (< a b) (> a b))) > > Yes, but for that, you have to know what "=" is. Is it eq? Is it > eqv? Is it equal? (yeah, lame pun with question marks). Or is it > (see below)? > It's equal in the sense of (not (or (< a b) (> a

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 8:23 PM wrote: > (lambda (p1 p2) (< (car p1) (car p2))) > > Then you'd need a corresponding equal, because otherwise you > end up with things which are neither less nor equal nor greater, > i.e. the ordering isn't total, which is bad for sorting :) > `sort' assumes that

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
On Mon, Dec 9, 2024 at 8:45 PM Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 8:23 PM wrote: > >> (lambda (p1 p2) (< (car p1) (car p2))) >> >> Then you'd need a corresponding equal, because otherwise you >> end up with things which are neither less nor equal nor greater, >> i.e. the ordering

Re: sorted?

2024-12-09 Thread tomas
On Mon, Dec 09, 2024 at 08:45:33PM +0100, Mikael Djurfeldt wrote: > On Mon, Dec 9, 2024 at 8:23 PM wrote: > > > (lambda (p1 p2) (< (car p1) (car p2))) > > > > Then you'd need a corresponding equal, because otherwise you > > end up with things which are neither less nor equal nor greater, > > i.

Re: sorted?

2024-12-09 Thread Mikael Djurfeldt
Den mån 9 dec. 2024 21:36 skrev: > On Mon, Dec 09, 2024 at 08:45:33PM +0100, Mikael Djurfeldt wrote: > > On Mon, Dec 9, 2024 at 8:23 PM wrote: > > > > > (lambda (p1 p2) (< (car p1) (car p2))) > > > > > > Then you'd need a corresponding equal, because otherwise you > > > end up with things whic