{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.
A1 = x * y + x
A2 = y * x + y 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.They aren't in q either: x can be redefined to whatever you like.
How does KatLang determine which argument is first? Is it merely the first free variable?
They aren't in q either: x can be redefined to whatever you like.
How does KatLang determine which argument is first? Is it merely the first free variable?
It does! Elixir (coming from Erlang) and Haskell have the same thing, both through pattern matching of a function to different definitions. OCaml (and most other languages using pattern matching) pattern match inside a single definition.
> In mathematics exists many different concepts which are called perfect. For example, perfect numbers.
I personally only know about perfect numbers. I'm not sure if it's a great name for them, or if it's just a "fun" name like sexy prime https://en.wikipedia.org/wiki/Sexy_prime that doesn't mean much.
For your example about the identity function, I think it's great, but I'm personally more in favour of positional lambdas like &1 in Elixir.
> 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.
Maybe "minimal" would be a better name then? Or "shortest"? Many people could argue on what makes the perfect lambda, but it's hard to argue that yours isn't the most minimal or shortest.