Re: design pattern wanted

From: Bernd Brassel <bbr_at_informatik.uni-kiel.de>
Date: Mon, 14 Apr 2008 11:03:24 +0200

Steffen Mazanek wrote:
> I got two replies so far. The first one suggested a solution
> where instantiated and uninstantiated edges are hold in
> two different data structures. But I guess this can only
> be done making heavy use of unsafe functions and losing
> nice properties.

This depends on the concrete way you want to use this. Maybe you know
beforehand when you add "free edges" and when you add ground ones? This
way you could well separate the data for inserting but not for
searching. For example an interface couild be:

insertEdge :: Edge -> Graph -> Graph
insertFree :: Graph -> Graph
findEdge :: Graph -> Edge

But intuitively, I would say that with this separation you do not need
free variables at all.

Another thought: How about returning free variables on default, i.e.,
when the edge is not found in the graph? Of course I do not know whether
this complies with your application.

Cheers
Bernd
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mo Apr 14 2008 - 11:31:31 CEST

This archive was generated by hypermail 2.3.0 : Do Apr 18 2024 - 07:15:09 CEST