generateStamp isn't a method. It's a value. let-bound functions have the form

let funcName args = ...

whereas let-bound values have the form

let someValue = ...

There are no args here. generateStamp is a value. It's a function value, of type unit->int. So you can call it like it's a function/method. But the thing you're calling is the lambda that's bound to the name. Each time you call it, the body of the 'fun' is executed, but the body of 'generateStamp' is only executed once when the program/module is initialized. You can see this by adding 'printf's to the code (e.g. before 'let count' and before 'count :=').

Does it make sense?

By on 4/6/2009 6:33 PM ()

Absolutely. Never quite realized the "functional" difference between when the arguments are present and when they're not.

I appreciate the help.

By on 4/6/2009 7:09 PM ()

To create a function with no parameters (instead of a value), declare an argument of type "unit" (similar to null) via a set of empty parens:

let funcName () = ...

By on 4/7/2009 7:50 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