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

a typo; min/max; partial orders



Hi, I don't know if discussion is still allowed for SRFI 32, but it's
still listed as being in draft mode on the SRFI web site so I figured
I'd post.

First of all, there's a typo in the draft posted at
http://srfi.schemers.org/srfi-32/srfi-32.txt :

  This is due to the definition of equality, given a < comparator:
    (and (not (< x y))
         (not (< y x)))
  The definition is rather different, given a <= comparator:
    (and (<= x y)
         (<= x y))

The last line should read

         (<= y x))

Now, my requests: it would be nice to have generalized versions of the
R5RS `min' and `max' functions, that take a list or vector and a
comparison operator.  Even more generally, they could take a count N,
and return the N least or greatest elements of the list or vector.
Would it be reasonable to put these in SRFI 32, or do they belong
somewhere else?

What I *actually* need right now is a function to compute the list of
minima of a list given a partial order.  Topological sort and
order-preserving insertion would be nice too.  Olin Shivers wrote, in
this forum, "worrying about partial orders is a snare & a delusion".
Does this mean that partial-order algorithms belongs in a separate SRFI?

--dougo@xxxxxxxxxxx