guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sorted?


From: tomas
Subject: Re: sorted?
Date: Mon, 9 Dec 2024 14:11:51 +0100

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 of course).
> 
> Now, `sorted?' returns true if its input is what `sort' would have produced
> as output, otherwise false.

Hmmm. Perhaps, what throws me off the rails is that you can pass
a "less" predicate to sorted?.

To behave like it does, it has to have some notion of equality,
which seems to be implicit and doesn't necessarily harmonize with
the less predicate you pass to it.

Something like that.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]