Re: design pattern wanted

From: Bernd Brassel <>
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.

curry mailing list
Received on Mo Apr 14 2008 - 11:31:31 CEST

This archive was generated by hypermail 2.3.0 : Sa Apr 13 2024 - 07:15:10 CEST