[Haskell-beginners] Tree-like Structure with unique elements on each level

Stephen Tetley stephen.tetley at gmail.com
Mon Jan 4 17:51:57 UTC 2016


Hi Martin

The essence of a trie data structure is that all keys at each level
are unique, so so lookup in a trie forms a search path.

There are various implementations of tries on Hackage.

Best wishes

Stephen

On 2 January 2016 at 19:53, martin <martin.drautzburg at web.de> wrote:
> Hello all,
>
> I recently modeled a tree like this:
>
> data Predicate a = Any | Pred (S.Set a)
> data Product a = Pany | Prod (S.Set(Predicate a, S.Set(Product a)))
>
> What I wanted to achieve was to have each element only once on each level. Hence the Sets. But this structure does not
> achieve this. I can easily duplicate elements on a level as long as their subordinates are different, so I might as well
> give up working with sets.
>
> Is there a way to construct a tree where each element can occur only once on each level?
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


More information about the Beginners mailing list