Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!asuvax!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Optional static typing limits Message-ID: <2325@optima.cs.arizona.edu> Date: 23 Apr 91 17:25:16 GMT Sender: news@cs.arizona.edu Lines: 25 In article <1991Apr22.153149.8082@newcastle.ac.uk> Chris Holt writes: ]What would be nice would be something of the form ] ]Sort S <= ] where ] S : sequence of D ] D : domain ] <= : partial_order (D x D -> boolean) ] where ] partial_order : transitive & reflexive & antisymmetric I know that is the standard solution, but I wonder if a better solution wouldn't be a function $ord : D -> Int$ that maps domain objects into arbitrary integers with the property that if $d1 < d2$ by the partial order, then $ord(d1) < ord(d2)$. ($d1 < d2$ means that $d1 <= d2$ and $d1 =/= d2$.) You would lose the partial order with this function (so you might want to implement <= anyway), but it seems that $ord$ has more general uses. It works for a wider variety of sorting methods, for example, and could also be used for a hash function. -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman