Q:

f# generating a next value function

Given a list [1, 2] I am trying to create an anonymous function that generates a tuple of
(next value * a function that generates the next value)
...  something along the lines of
f = createFunc([1; 2])
(v1, f1)  = f()    //v1 = Some 1
(v2, f2)  = f1()   //v2 = Some 2
(v3, f3)  = f2()   //v3 = None

I can do this easily enough in Elixir, but am banging my head against the wall in F#.  Any pointers gratefully received.  My attempt so far looks like:
let top_and_tail (l: list<'a>): (Option<'a> * list<'a>) = 
    match l with
        | [] -> (None, [])
        | h :: t -> ((Some h), t)

let rec createFun l = 
    fun() -> 
        let (h, t) = top_and_tail(l)
        (h, createFun(t))

A:

Try to add type annotation to the signature of your function.  Its return type depends on the length of l. You can work around it by defining a recursive type: 
data Ret a = 
| End of a
| KeepGoing of a * (unit -> Ret a)

