Logo

Programming-Idioms

History of Idiom 17 > diff from v9 to v10

Edit summary for version 10 by :

Version 9

2015-08-23, 23:08:26

Version 10

2015-09-03, 03:49:16

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Idiom #17 Create a Tree data structure

The structure must be recursive. A node may have zero or more children. A node has access to children nodes, but not to his parent.

Code
data Tree a = Node {
    value :: a,
    children :: [Tree a]
}