Large Int Set in sml
1 answer
You can use a functor ListSetFn
. From the documentation, you will find:
functor ListSetFn (ORD_KEY) : ORD_SET
This is to say that it ListSetFn
is a functor that accepts a structure that satisfies a signature ORD_KEY
, which you can find in the documentation as:
type ord_key
val compare : (ord_key * ord_key) -> order
Basically, you need to create a structure that satisfies the signature ORD_KEY
, for example:
structure LargeIntKey : ORD_KEY =
struct
type ord_key = LargeInt.int
val compare = LargeInt.compare
end
And then you can instantiate the LargeInt
functor ListSetFn
by doing:
structure LargeIntSet = ListSetFn(LargeIntKey)
+3
source to share