title: Haskell Non-Binary Tree
body: <p>For a school assignment, I made a binary tree implementation in Haskell as such:</p>
  
  <pre><code>data BinTree = L | N BinTree BinTree deriving (Eq, Show)
  
  -- this function creates the full binary tree of size 2^(n+1) -1
  makeBinTree 0 = L
  makeBinTree n = N (makeBinTree (n-1)) (makeBinTree (n-1))
  </code></pre>
  
  <p>Which creates a binary tree in which each parent node has two children.
  So, makeBinTree 3 has the following output: N (N (N L L) (N L L)) (N (N L L) (N L L))</p>
  
  <p>For my own understanding, I was hoping to make a tree such that each parent node has an arbitrary number of children. I've been stuck for a while on how to proceed.</p>
  
  <p>So the input would be: </p>
  
  <p>makeBinTree 2 3 </p>
  
  <p>and the output would be:</p>
  
  <p>N (N L L L) (N L L L) (N L L L)</p>
  
  <p>Any hints of how to do it would be greatly appreciated.</p>