[Haskell-beginners] How to correctly define data types?
Brent Yorgey
byorgey at seas.upenn.edu
Tue Jul 19 21:50:41 CEST 2011
On Tue, Jul 19, 2011 at 01:46:19PM -0300, Davi Santos wrote:
> Brent, thanks for answering.
> Sorry, by "set" I meant "access" [the field "attributes"]. But you already
> answered, it depends on the ML module implementation choice.
>
> One more question about elegance:
> How to make Examples "sortable" by distance to a reference point
> "referenceEx"?
To sort by distance to a given reference point you could use something
like
import Data.List (sortBy)
import Data.Ord (comparing)
...
sortedExamples = sortBy (comparing (distance referenceEx)) listExs
-Brent
More information about the Beginners
mailing list