[r6rs-discuss] Comparison procedures' number of arguments
Abdulaziz Ghuloum
aghuloum at cs.indiana.edu
Tue Oct 21 10:42:48 EDT 2008
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,,,
More information about the r6rs-discuss
mailing list