title: F# using a list to recursively build a Fable.Forms object
body: <p>I have a recursive problem trying to use a library to generate forms dynamically. The library is <a href="https://mangelmaxime.github.io/Fable.Form/" rel="nofollow noreferrer">Fable.Forms</a></p>
  <p>If we were basing my problem with that page's first example, my goal would be to have email and password (and more fields obviously) in a collection, then have a recursive process that builds the form dynamically.</p>
  <p>Here's a naive version of &quot;solving&quot; the problem:</p>
  <pre><code>    let fields = [ fieldA; fieldB ]
  
      match fields |&gt; List.length with
      | 1 -&gt;
          Form.succeed (fun _ -&gt; Nothing)
          |&gt; Form.append (fields |&gt; List.head)
      | 2 -&gt;
          Form.succeed (fun _ _ -&gt; Nothing)
          |&gt; Form.append (fields |&gt; List.head)
          |&gt; Form.append (fields |&gt; List.tail |&gt; List.head)
      | _ -&gt; failwith &quot;..... gotta solve using tail recursion!!&quot;
  </code></pre>
  <p>My problem is that I need to know the exact number of fields <em>in advance</em> to give to the Form.succeed anonymous function the correct number of &quot;input&quot; arguments.</p>
  <p>eg, if the list has:</p>
  <ul>
  <li>1 fields, I need to call Form.succeed with (fun ? -&gt; ...) then append fields in list</li>
  <li>2 fields, I need to call Form.succeed with (fun ? ? -&gt; ...) then append fields in list</li>
  <li>3 fields, I need to call Form.succeed with (fun ? ? ? -&gt; ...) then append fields in list.</li>
  </ul>