-
I still don't understand what's going on. Any chance you could explain it in a little more detail? I'd love to start learning OCaml, but I've just never gotten around to it.
-
I added an update to the post, that hopefully makes things a bit clearer.
-
Much nicer. The problem I was having understanding the code was that my mental parser just assumes that a line starting in '#' is a comment. I was having a very difficult time figuring things out while I assumed that the input lines were comments.
Duh.
-
They're not that different, I only need three extra characters to get OCaml semantics. ;)
>>> def g(x,f=f): return f(f(x))
...
>>> g(5)
20
>>> def f(x): return 3*x
...
>>> g(5)
20
-
The # marks are the prompt for the ocaml toplevel interpreter.
I've been learning OCaML as part of a comp. ling. course. Check out the course notes and examples here:
http://www.msu.edu/course/lin/475/
The course notes and examples are excellent if you're looking to learn OCaML.
-
""" They're not that different, I only need three extra characters to get OCaml semantics. ;)"""
Hm, indeed. But can you make OCaml behave like Python? :-)