Live data from Hacker News

Show HN: KatLang – Language for Calculations

katlang.org

41–46 of 46 posts

Re: Show HN: KatLang – Language for Calculations

#41
post #36

Earlier quoted context omitted.

According to Q documentation, Q supports only 3 implicit parameters x, y, z: https://web.archive.org/web/20190213035913/http://code.kx.co...

They're just variables like any other; {[x;y;z] x+y z} is almost exactly the same as {x+y z}

I tested and seems, that x is the first implicit parameter, y - second, z - third. It is as stated in their online documentation. When you try following example:

  {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.

Re: Show HN: KatLang – Language for Calculations

#42
post #36

Earlier quoted context omitted.

They're just variables like any other; {[x;y;z] x+y z} is almost exactly the same as {x+y z}

I tested and seems, that x is the first implicit parameter, y - second, z - third. It is as stated in their online documentation. When you try following example: {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 keywor…

No. They are not keywords. The program:

    x:42;
    f:{[a]x+a}
is the same as:

    x=42;
    f=function(a){return x+a}

Re: Show HN: KatLang – Language for Calculations

#43
post #36

Earlier quoted context omitted.

They're just variables like any other; {[x;y;z] x+y z} is almost exactly the same as {x+y z}

Can you explain the difference little bit more, Maybe using Javascript pseudocode as comparable example? I want to understand how Q is different from KatLang. The problem with me is that I do not know where I can try Q code, therefore I rely only on the documentation fragments I can find.

Last I checked there was a free download with an email on kx.com

Re: Show HN: KatLang – Language for Calculations

#44
post #42

Earlier quoted context omitted.

I tested and seems, that x is the first implicit parameter, y - second, z - third. It is as stated in their online documentation. When you try following example: {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 keywor…

No. They are not keywords. The program: x:42; f:{[a]x+a} is the same as: x=42; f=function(a){return x+a}

Thanks for explaining! But how about this example:

  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.

Re: Show HN: KatLang – Language for Calculations

#45
post #42

Earlier quoted context omitted.

No. They are not keywords. The program: x:42; f:{[a]x+a} is the same as: x=42; f=function(a){return x+a}

Thanks for explaining! But how about this example: 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.

q's functions don't capture the environment, so that's the same as:

    a:42
    {[a]a+1}[5]
and as in javascript:

    a=42;
    f=function(a){return a+1}
and when i say they don't capture the environment, i mean this:

    f:{[g] {g+x}}
doesn't do anything except generate errors (° there are benefits to this approach!) because the inner function (that we are returning) sees the "global" g and not the one lexically scoped in the function (a better way to say it: no closures).

Re: Show HN: KatLang – Language for Calculations

#46
post #5

I wonder why no (proper) https?

Page does not require any authentication and I wanted to make it simple. But too many people are asking about https, so I will configure https.

Ack on the simplicity part and not needing to talk to the server after the first load. But the main concern is that stuff could simply be injected on that first load.

Depending on how you host, the easiest solution might be to use the caddy web server which has letsencrypt built in.

Post reply on HN