by rabarbers · 4y ago · 0 comments
{y+x*z}[1;2;3]
It gives result:5
And in Q you cannot define implicit parameters with names, for example,: a, b, c. But You can define parameters explicitly:
{[a;b;c]a+b*c}[1;2;3]
I still think that their implicit parameters are keywords. Similarly as keyword 'it' in Kotlin programming language is used to refer to the single parameter of the lambda expression.In KatLang there are no predefined implicit parameter names. The user is the one who defines implicit parameters by declaring the implicit parameter names.
x:42;
f:{[a]x+a}
is the same as: x=42;
f=function(a){return x+a} x:42
{x+1}[5]
It results in 6
It seems like you can define variables with the name 'x', but when you do not have explicit parameters, then the identifier 'x' is used to refer to the first implicit parameter, y - for second and z - for the third parameter. In context of implicit parameters x, y and z acts like predefined keywords.