[r6rs-discuss] Comparison procedures' number of arguments
Ken Dickey
Ken.Dickey at whidbey.com
Tue Oct 21 11:04:17 EDT 2008
On Tuesday 21 October 2008 07:42:48 Abdulaziz Ghuloum wrote:
> On Oct 21, 2008, at 8:03 AM, Ken Dickey wrote:
> > Doesn't it make more sense to require existence for comparison?
>
> Existence of one ordered pair does not matter much. You need
> to either prove the existence of a counter example to produce
> #f, or to prove universality (e.g., with for-all) to produce #t.
>
> You can't say: I'll require that all adjacent pairs are ordered,
> except when there are no pairs, where I'll switch my logic and
> demand the existence of an ordered pair.
>
> > (define (monotonic? ordered? sequence)
> > (let ( [list-of-pairs (pairs-in sequence)] )
> > (if (null? list-of-pairs)
> > #f
> > (for-all
> > (lambda (pair) (ordered? (car pair) (cdr pair)))
> > list-of-pairs))
> > ) )
>
> You just made an arbitrary exception to the rule by providing
> an arbitrary value for the (null? ---) case. I don't see that
> following your rule of least surprise.
>
> Aziz,,,
No. Actually, I'd like a holds-for-all which returns #f as the base case.
-KenD
More information about the r6rs-discuss
mailing list