12 karma · joined May 3, 2011 (15y ago) · 38 submissions
1.
Ask HN: Looking for a good course to learn proof assistant Lean 4
5 points · by rabarbers · 1y ago · 4 comments
comment 4y ago · link · parent
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.comment 4y ago · link · parent
{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.
comment 4y ago · link · parent
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.comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
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.
comment 4y ago · link · parent
I agree, that parameter ignorance operator # is ugly. I do not like it. The plan is to remove it in the future versions, but it requires some research.
About expression reading and parsing... Your argument is correct, but KatLang expressions are relatively short. I do not expect that KatLang will replace general purpose programming languages. KatLang is just a simple language for calculations. Main goal was to redesign the calculator and KatLang is good for that.
comment 4y ago · link · parent
comment 4y ago · link · parent
A1 = x * y + x
A2 = y * x + x
A1(1, 2), A2(1, 2)
returns results 3, 4
If You want to change parameter order, You can use Grace~ operator like this: A1 = x~ * y + x
it moves parameter x one position towards the end of the parameters list.Sorry, I do not know how to post code snippets in HN properly.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
24.
Show HN: KatLang – Language for Calculations(katlang.org ↗)
17 points · by rabarbers · 4y ago · 45 comments
comment 12y ago · link · parent
comment 12y ago · link · parent
comment 12y ago · link · parent
In my belief down-voting system is unfair. Especially if you are advised to shut-up when you are down-voted because it makes conversation boring... As HN does not stimulate responsible conversation, but only something like "say and shut-up if we do not like you", there are no reason for me to keep track of conversation and provide more arguments to prove that I am right.
comment 12y ago · link · parent
29.
Implicit lambda calculus(publicationservice.org ↗)
1 points · by rabarbers · 12y ago · discuss