[MLton] MLtonIntInf.rep

Wesley W. Terpstra wesley at terpstra.ca
Wed Sep 2 07:09:12 PDT 2009


There is already this in MLtonIntInf:

      *structure* BigWord : WORD
      *structure* SmallInt : INTEGER
      *datatype** rep *=*
         Big of BigWord.word vector
       *|* Small of SmallInt.int
      **val* rep: t -> rep

This is pretty useful since it makes it possible to convert an IntInf into a
byte-stream or hexadecimal in linear-time. Without this API the fastest
algorithm I know requires nlog(n) time using  >> recursively. However, I
also need to be able to convert the other direction too; from rep to t. I
can see this is easy enough to do with Prim.fromVector. Does anyone have an
objection to the addition of 'fromRep' to MLtonIntInf? Otherwise loading an
IntInf from the network will have to be slow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20090902/b672c566/attachment.html


More information about the MLton mailing list