This is an inspiring project. It would have taken me far more than five weekends to create this, so you can feel smug knowing you're about ten times as efficient as a random HN member!
I have a couple of criticisms. First of all, strange things happen when a semicolon is omitted from the end of a function definition. In the following example, there is no output. What's going on?
square = { n |
n * n
}
println(square(5));
Second, according to the rules for omitting parentheses, it seems like this should output "25". Instead, it outputs "Function5":
square = { n |
n * n
};
println square(5);
It seems like it's passing "square" and 5 as separate parameters to println, which is unlikely to be the intended behavior in most cases.
Lastly, is recursion possible?
factorial = { n |
if (n < 2) { 1 }
{ n * factorial(n - 1) }
};
println(factorial(5));
That code generates the following error:
Error: function identifier expected ('Exp() :3:5' found) at line 3 char 5
Anyway, I don't mean to nitpick! Do you plan on developing this further?
This is an inspiring project. It would have taken me far more than five weekends to create this, so you can feel smug knowing you're about ten times as efficient as a random HN member!
I have a couple of criticisms. First of all, strange things happen when a semicolon is omitted from the end of a function definition. In the following example, there is no output. What's going on?
Second, according to the rules for omitting parentheses, it seems like this should output "25". Instead, it outputs "Function5":It seems like it's passing "square" and 5 as separate parameters to println, which is unlikely to be the intended behavior in most cases.Lastly, is recursion possible?
That code generates the following error:Anyway, I don't mean to nitpick! Do you plan on developing this further?