Re: eqtype and functors

brian <briand-/[email protected]> Thu, 31 May 2007 20:55:56 -0700
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
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.

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_ ? ;-)


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/