ocaml module and program in same file
<p>Is it possible in ocaml to have a <code>.ml</code> file which provides a function to be used from another file but can also be used as a standalone program?</p>

<p>Let me clarify with an example. In Python, you can do this:</p>

<pre><code>#This file is square.py

def my_square(i) :
    print "square of %d is %d" % (i,i*i)

if __name__ == '__main__' :
    my_square(10)
</code></pre>

<p>Now, I can run the above as a standalone program : <code>python square.py</code>  but I can also include it from another file by saying <code>import square</code>  to get access to the <code>square</code> function.</p>

<p>How (if possible) does one do this in ocaml?<br>
Thanks!</p>