Seq.unfold's first argument is a function which itself takes items of type 'a and returns an optional tuple. In this case, ('b*'a) is the type parameter for the option type (that is, the result of the function could be None or Some p, where p is a pair of a 'b and an 'a). This is made more confusing by the fact that generic types can take their parameters .NET-style, like option<'b*'a>, or ML-style, like ('b*'a) option, or byte array, or int list, etc.

As to your second question, the = sign is not part of the type; instead, F# is telling you that the automatic 'it' variable has type (('a -> ...), and is equal to whatever the rest of the line said, but which you have elided. For me, the remainder of the line finishes with <fun:clo@0>, which is F#'s way of displaying a compiled closure. Compare this to what happens if you type in a literal, such as [1;2;3]; in the case of lists the printed representation of the value is more useful.

By on 8/14/2009 10:37 AM ()

Ah, ok, that makes perfect sense now on the option definition, I don't know what I was thinking. My brain is a little mushy right now from all this... :)

I see what your saying on the closure as well. If I keep redefining that same method over and over the function name suffix increments ("clo{at}0-1", "clo{at}0-2", ...) as it should.

Thanks for your help!

m

By on 8/14/2009 10:51 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper