[MLton] Structures inside a function?
Fri, 21 Jan 2005 07:34:51 -0800
> > functor GroupMulPercent(G : GROUP) =
> > struct
> > val (op *%) = G.MUL
> > val (op /%) = G.DIV
> > val (op !%) = G.INV
> > ...
> That is an interesting technique for quickly generating different
I like it too. Someone should add to the wiki this technique and the
others we've discussed. I'd love to see progress on our MLton/SML
cookbook (perhaps start a new Cookbook page, linked from StandardML?).
I might even go further and drop the percents.
functor GroupOps (structure G: GROUP) =
val op * = G.MUL
val op / = G.DIV s
val op ! = G.INV s
The point being that you open the result of GroupOps in situations
where the usual definitions of the arithmetic ops might be
unnecessary, or it might be worth the conciseness to use qualified
identifiers for the usual functions (because they are in that context