Ken Dickey wrote:
On Sunday 19 October 2008 12:30:27 Thomas Lord wrote:
For the numeric comparison functions we have a clear
account of what the code is supposed to model, e.g.,
monotonic sequences of numbers.

Ah. I can see where you can use lists of numbers to model sequences. I have always used numeric comparison predicates were to compare two or more numbers.

Would it not be more clear to use 'sequence, 'sequence-append, ... to 'list, 'append, ... and (sequence-ordered? < ...) to (apply < ...) ?

That's an interesting perspective.

You have persuaded me that:

1) all sequence predicates whose definition is (normally) founded
   (in the usual pair-wise way) in the definition of a binary predicate
   should accept 0 or more arguments

2) either:
  2a) sequence predicates should not be primitive in Scheme
  2b) every predicate that is trivially convertible to a sequence
       predicate (accepting 0 or more arguments) should be specified
       in the first place as a sequence predicate

  Rationale for 2a:  they can be constructed in a generic way
  from binary predicates as in (sequence-pairwise? < ...)

  Rational for 2b: the sequence predicate can always be used
  as the binary predicate.

  Rationale against 2a: that's inconvenient.

  Rationale against 2b: weak error checking when a predicate
  is used as a binary predicate.

I like 2b.

So:

   (< 1 2 3) => error
   (<) => error
   (< 1) => error
   (< 1 2) => #t
   (number-seq-pairwise? <) => #t
   (number-seq-pairwise? < 1) => #t
   (number-seq-pairwise? < 1 2) => #t
   (number-seq-pairwise? < 1 2 3) => #t

That's fine with me, too.    Scheme standards might describe
some syntax, for convenience so that:

   (number-seq-pairwise? <

is equivalent to

  (<...

(The three dots there are part of the identifier name in the CAR position)

  (< 1 2 3) => error
  (<... 1 2 3) => #t

etc.

I think you have convinced me that the conflation of the
sequence operator and the "founding" binary relation is a
cute hack but one that trades away safety, needlessly.

Do we really need "number-seq-pairwise?" or is there a good way
to define just a generic "seq-pairwise?" yet somehow know
how to type-check a single argument?

-t







Cheers,
-KenD


_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to