title: Elm: Split list into multiple lists
body: <p>I'd like to be able to split a list up into multiple lists.
  I'm assuming this would need to be stored in a <code>tuple</code> - although not completely sure.</p>
  
  <p>Say I have this group of 8 people</p>
  
  <pre><code>users =
    ["Steve", "Sally", "Barry", "Emma", "John", "Gustav", "Ankaran", "Gilly"]
  </code></pre>
  
  <p>I would like to split them up into a specific amount of groups.
  For example, groups of 2, 3 or 4 people.</p>
  
  <pre><code>-- desired result
  
  ( ["Steve", "Sally", "Barry"]
  , ["Emma", "John", "Gustav"]
  , ["Ankaran", "Gilly"]
  )
  </code></pre>
  
  <p>Part 2 of this question would be, How would you then iterate and render the results from a tuple of various lengths?</p>
  
  <p>I was playing around with this example, using <a href="https://github.com/zarvunk/tuple-map" rel="nofollow">tuple-map</a>
  but it seems to only expect a tuple with 2 values.</p>
  
  <pre><code>import Html exposing (..)
  import List
  
  data = (
    ["Steve", "Sally", "Barry"]
    , ["Emma", "John", "Gustav"]
    , ["Ankaran", "Gilly"]
    )
  
  renderLI value =
    li [] [ text value ]
  
  renderUL list =
    ul [] (List.map renderLI list)
  
  main =
      div [] (map renderUL data)
  
  -- The following taken from zarvunk/tuple-map for examples sake
  
  {-| Map over the tuple with two functions, one for each
  element.
  -}
  mapEach : (a -&gt; a') -&gt; (b -&gt; b') -&gt; (a, b) -&gt; (a', b')
  mapEach f g (a, b) = (f a, g b)
  
  {-| Apply the given function to both elements of the tuple.
  -}
  mapBoth : (a -&gt; a') -&gt; (a, a) -&gt; (a', a')
  mapBoth f = mapEach f f
  
  {-| Synonym for `mapBoth`.
  -}
  map : (a -&gt; a') -&gt; (a, a) -&gt; (a', a')
  map = mapBoth
  </code></pre>