Closed bieganski closed 2 years ago
Well, this kind of thing is currently made to only support one-param functions, to avoid even more ambiguity. the problem is that it needs to be able to figure out if you're multiplying or not. For example if you write sin2x
, it should interpret it as sin(2*x)
, and spaces are not kept from the tokenizing. However, if given enough context, the parser may be able to figure it out, but that may lead to excessive complexity.
I disagree that g 1 2
should work. It is fairly common in mathematics to temporarily adopt additional notation, so one can e.g. say:
Let x∗y denote 1-(1-x)+(1-y). Now, 0.5∗0.5 = 0.75 …
When using a 2-param function without parenthesis, the first parameter should be taken from the left of the function name. This will allow writing the above human language as:
>> ∗(x,y) = 1-(1-x)(1-y)
>> 0.5∗0.5
0.75
This would lead to excessive complexity and is probably not worth it.
Haskell-like function application would be very useful, is it meant to be supported only for one-param functions?