Re: eqtype and functors
John Reppy <[email protected]> Fri, 1 Jun 2007 09:16:40 -0500
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
On May 31, 2007, at 10:55 PM, brian wrote: > Well I was trying to understand how to make the code operate as > intended. > Obviously the purposed of the GRAPH_NODE sig is so that you can use > some other datatype as node info. But then having a type definition doesn't make sense. Either you want the node type to be an abstract equality type, or you want it to be a concrete type. > > Upon fursther reflection, it seems like it should just use int's > all the time. > Any associated data can simply be stored in an array indexed by the > node number. > > Do you (or anyone else) know of any good graph algorithm packages ? > > Or am I going to have to write one _again_ ? ;-) Graph libraries are hard to design (Emden Gansner and I tried a couple of approaches, but we were never happy with the tradeoffs). The MLRISC toolkit has a fairly complete graph library (see MLRISC/graphs) that you might find useful. - John > > > Brian > > On May 31, 2007, at 7:26 AM, John Reppy wrote: > >> A better fix would be to just drop the "eq", since int is an eqtype >> by definition. >> >> - John >> >> On May 30, 2007, at 10:39 PM, brian wrote: >> >>> Hi, >>> >>> I'm trying to use fgl (a functional graph library) and I ran across >>> this: >>> >>> signature GRAPH_NODE = >>> sig >>> eqtype node = int >>> end >>> >>> sml throws an error on that statement. I simply removed the "= int" >>> to fix it. >>> >>> This change however causes another problem. I've put the rest of it >>> at the bottom of the e-mail because I think the short question is: >>> what do I do to implement the intent of the original code ? >>> >>> Thanks >>> >>> Brian >>> >>> >>> applic/lamtr.sml:128.18-128.50 Error: operator and operand don't >>> agree [tycon mismatch] >>> operator domain: (int * Value.node_label list * (G.node * >>> G.node * >>> 'Z) list >>> -> (Value.node_label,'Z) G.graph) >>> * (int * int * CombExpr.comb_term >>> -> int * Value.node_label list >>> * (G.node * G.node * 'Z) list) >>> operand: (int * Value.node_label list * (G.node * >>> G.node * >>> 'Z) list >>> -> (Value.node_label,'Z) G.graph) >>> * (int * int * CombExpr.comb_term >>> -> int * Value.node_label list >>> * (int * int * Value.edge_label) list) >>> in expression: >>> G.mkgr o UTuple.t23 o toEdgeList >>> >>> Here's the statement: >>> >>> fun toGraph r l = (G.mkgr o UTuple.t23 o toEdgeList) (r, >>> 0,E.comb l) >>> >>> and it's in a functor: >>> >>> functor LambdaTrans (G:GRAPH) = >>> struct >>> ... >>> >>> So if I parse the error message correctly, it looks as though there >>> is a problem in the the function composition. I believe that the >>> problem is toEdgeList is assuming that the node/node ID is an >>> integer, when in fact it's actually a TBD type. >>> >>> >>> -------------------------------------------------------------------- >>> -- >>> --- >>> This SF.net email is sponsored by DB2 Express >>> Download DB2 Express C - the FREE version of DB2 express and take >>> control of your XML. No limits. Just data. Click to get it now. >>> http://sourceforge.net/powerbar/db2/ >>> _______________________________________________ >>> Smlnj-list mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/smlnj-list >>> >> >> >> --------------------------------------------------------------------- >> ---- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Smlnj-list mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/smlnj-list > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/