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
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|.
Then, testing it in the REPL give me this :
scheme@(guile-user)> (sorted? '(1 2 3) <)
$13 = #t
So far so good.
scheme@(guile-user)> (sorted? '(3 2 1) <)
$16 = #f
Still good. But
scheme@(guile-user)> (sorted? '(1 1) <)
$17 = #t
I was expecting #f due to
scheme@(guile-user)> (< 1 1)
$18 = #f
Anything I missed on the way maybe…
Jérémy