rabarbers
Joined 15 years ago
Karma
12
Submissions
38
Member since
May 3
Joined 15 years ago
{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.
function A1(x, y) {return x*y + x; }
But A2 would be: function A2(y, x) {return y*x + y; }
If you do not like the default order of implicit parameters, you can always use Grace~ operator to move x or y. Prefix form moves the parameter one position towards the beginning of the parameters list, postfix form moves one position towards the end of the parameters list: A1 = y~ * x + y
or A1 = y * ~x + y
or
[Edit] A1 = y * x + y~
In the last example take into consideration, that without Grace~ operator y is the first parameter, so, you need to move it one position towards the end of the parameters list - therefore use postfix form of Grace~ operator. function(x) {return x; }
In KatLang You can define it as: x
The question is: can you remove one more symbol without changing the meaning of the expression? If no, then, the identity function definition 'x' is symbols perfect according to my definition. Of course, I rely on the usage context and it allows me to hide some part of critical information and focus only on the short lambda expression.Thanks for the elixir examples.