Wow. If you ever wanted curly braces or multi-line lambdas in Python this looks like the way to do it.
(See point-free style.)
def doSomething():
def doSomethingElse():
# Code goes here.
pass
eggs = filter(doSomethingElse, spam)
for cheese in eggs:
# Do something.
passI really don't get why some people hate the indention-as-syntax. Sure, its different to C and Java, but it also results in (more) consistently formatted code and readable indention. It also only takes a day or two to get used to, even if you're a hardened C++ user (for the record, I have nothing against C/C++ syntax, I actually switched from years of C++ to Python as my main language and I just recently started a C++/Python hybrid project).
# value x =[|1;2;3;4|];
value x : array int = [|1; 2; 3; 4|]
# for i = 0 to (Array.length x) - 1 do {
Printf.printf "%d" x.(i);
};
1234- : unit = ()
# Array.iter (fun y -> Printf.printf "%d" y) x;
1234- : unit = ()
Basically the entire body of any for loop I would want to make an anonymous function. Then if I cared about the result I could do: # Array.map (fun y -> Printf.printf "%d" y) x;
1234- : array unit = [|(); (); (); ()|]
Assuming the underlying platform supported it, and the function is pure, that's "free" parallelism.