title: Golang: Recursive data structures
body: <p>I have a simple question... I'm trying to reproduce this recursive data structure in Golang with slices.</p>
  
  <pre><code>type Trie map[byte]Trie
  </code></pre>
  
  <p>Right now I have some 'rough' source code using the recursive data structure below with slices and everything works fine except my typed structure is a structure and not a slice of structures. Ideally I would like my typed recursive data structure to be a slice of Trie's which has elements Trie{byte, []Trie}. Hope that makes sense? Right now I have a type which is a Trie struct{byte, []Trie}. </p>
  
  <pre><code>type Trie struct {
  elem byte
  others []Trie
  } 
  </code></pre>
  
  <p>Maybe this will help. When I create my Trie of slices right now I use this function.</p>
  
  <pre><code>func CreateTrie() []Trie {
      return make([]Trie, 0, 13)
  }
  </code></pre>
  
  <p>I would like to have the Trie of slices defined in such a way that I could create the slices like this.</p>
  
  <pre><code>func CreateTrie() Trie {
      return make(Trie, 0, 13)
  }
  </code></pre>
  
  <p>Is this possible with slices or do I have use my first(only) solution for slices?</p>