
K7 Tutorial - chl
https://shakti.com/tutorial/
======
apricot
Man, I want to like J and K but the constant vibe of "this language is so
dense and complex, only a few genius programmers will ever understand it" is
getting old.

~~~
rpz
Have you had a look through the tutorial? Which parts of the tutorial made you
feel as if you needed to be a genius to understand it?

~~~
munificent
Well, the part where it says:

 _> Arthur Whitney's k and its derivatives have served a small number of
highly skilled programmers_

Doesn't exactly start off with an inclusive tone.

~~~
rpz
As a k programmer myself I'd say to take that statement with a grain of salt
and at least give the language a chance if you have some spare time. It's
certainly true that the community is small and it's certainly true that there
are plenty of really sharp programmers in the community but that doesn't mean
that you need to be a genius to write k code.

------
chrispsn
As a companion to this tutorial, the community is building out a clickable
version of the k7 reference card. It also covers the current state of Python-k
integration:

[https://k7contrib.gitlab.io/docs/](https://k7contrib.gitlab.io/docs/)

------
lolc
"Customer shall not, directly or indirectly, and shall not authorize any third
party to: (i) decompile, disassemble, reverse engineer, or otherwise attempt
to derive the source code of, reconstruct, or discover any hidden or
underlying elements of the Software"

Looks like I don't want to spend the effort learning it.

~~~
avmich
Just in case you want to look at the sources of something similar, here is a
good one:
[https://github.com/JohnEarnest/ok](https://github.com/JohnEarnest/ok)

~~~
tluyben2
I like oK because it allows nice toying around with graphics in the browser
but while k is incredibly fast, oK is really slow. It is nice to play with and
learn from but anything beyond, better check out Kona or another APL like like
A+ or J.

~~~
4thaccount
I'm not aware of too many folks using A+ anymore as it is pretty ancient and
hasn't been updated in a very long time.

Array languages I would consider for actual work are mostly:

Dyalog APL, J, and K if I could afford kdb+.

If I wanted to play with implementations I agree that Ok and Klong are pretty
cool.

------
justinsaccount
This a typo?

    
    
        x: 3 4 5 6 7 8 9 10
        y: 100 200 300 400
    
        ?[x;3;y] / replace what's in position 3 by y
      3 4 5 100 200 300 400 6 7 8 9 10

~~~
tmcb
Looks like the comment is zero-indexed as well. I wouldn't consider that a
typo.

~~~
justinsaccount
Pretty sure the output should be

    
    
      3 4 5 100 200 300 400 7 8 9 10
    

Otherwise that is not replacing, that is inserting.

Weird, I tried it on
[http://johnearnest.github.io/ok/index.html](http://johnearnest.github.io/ok/index.html)
and that agrees with the doc.. kinda confusing. Seems like it should be

    
    
      ?[x;3;y] / insert y at position 3
      ?[x;3 4;y] / replace what's in position 3 by y

~~~
tmcb
I see. In that case, the output is right and the comment is misleading.

~~~
justinsaccount
yeah, I updated my comment after finding
[http://johnearnest.github.io/ok/index.html](http://johnearnest.github.io/ok/index.html)
so I could test this out and came to the same conclusion.

------
nemo1618
"Shakti k also has primitives for blockchain operations."

That's... Interesting. I couldn't find any further mentions of "blockchain
operations" in the reference. What do they mean, exactly? Since k is
traditionally concerned with financial markets, I might guess that they're
offering deeply-integrated ways to parse transactions, check the number of
confirmations, query the current exchange rate, etc.?

~~~
tlack
It has built in RSA key stuff, common hash algorithms, and the ability to
encode/decode Bitcoin addresses. Perhaps other stuff too[1].

[1] [https://k7contrib.gitlab.io/docs/#shakti-
python](https://k7contrib.gitlab.io/docs/#shakti-python)

------
manjana
What's the benefit using k vs. c, cpp or java for the same? Does it run or
compile faster?

The article says you can do the same with cpp and some extra libraries, but I
wouldn't immediately think cpp or java was easily beatable -- manjana wonders
--

~~~
avhon1
K is interpreted, not compiled. You can run your code the instant it's
written.

As other's have said, K (the language and the interpreter) is highly optimized
for processing tabular data. I've heard of it outperforming C in processing
billions of rows of financial data. (Which, by my understanding, is K's
primary market.)

Lastly, K (like APL, J, A+, Klong, Kona, etc.) is very terse. A phrase I've
seen online is "one line of K is roughly equivalent to 100 lines of C". K
programs, like APL & co., very often fit entirely into a screenful of text,
but require close and complete reading to understand. There are lots of videos
on youtube of people writing literate sudoku solvers or conway's game of life
in a dozen lines or so, and terse solutions in a dozen or so characters.

People who like these programming languages tend to like their terseness --
they can view the entire program all at once (no scrolling or searching), and
refactor or rewrite the program in a few seconds of minutes of typing.

~~~
arrayThrowaway
If you would prefer to use keywords instead of symbols, Nial is a good option:
[https://github.com/danlm/QNial7](https://github.com/danlm/QNial7)

------
jxy
Is shakti related to kx? What is going to happen with kdb+?

I also have a practical question. Does `brandelf -t Linux bin/k` violate the
License agreement?

~~~
arrayThrowaway
The founders of Kx (Arthur Whitney and Janet Lustgarten) sold their stakes in
the company to First Derivatives plc and have now founded Shakti. Kdb+ is
still sold by Kx. Shakti seems to be a successor system to kdb+.

As for you second question, how would brandelf change the binary (disclaimer:
not a BSD user)?

------
max_
Does anyone understand if this is _fully compatible_ with Kdb+? been learning
q & it would be nice to add vanilla K7 to the list

~~~
yiyus
It is not. Every k version is in fact a new language (and rewritten from
scratch every time). That said, I guess they may implement some kind of
compatibility layer at some point.

~~~
SifJar
has been suggested on google group:
[https://groups.google.com/d/msg/shaktidb/184DnAJrwKU/HnNm3Dd...](https://groups.google.com/d/msg/shaktidb/184DnAJrwKU/HnNm3Dd0BwAJ)

------
ngcc_hk
Whilst One can run j in iOS, j and k are different. May have to try k again.

------
galaxyLogic
I wonder what are its improvements over APL?

~~~
4thaccount
K uses traditional ASCII characters and is usually bundled with kdb+ for
speedy timeseries analysis.

I would use Dyalog APL or J over K in many cases. K is also really expensive
(kdb+)...I'm not sure about Shakti (the K inventor formed a new company and
left the first one).

------
dman
Can someone compare this to Dyalog APL?

~~~
4thaccount
Dyalog uses non ASCII symbols which are really cool to me and make the
primitives very easy to learn. Check out tryapl.org to get a feel for it. You
can also download a trial version and there is a free book. They have decent
library support and full .NET support too as well as easy parsing for CSV,
JSON, XML...etc. They have Dyalog APL notebooks, database access,
multiplatform support, parallel and tacit features...etc. If it wasn't $1k a
year for a license (honestly pretty reasonable) I'd use it pretty often. It
just feels like they love their product and support it from the annual coding
competitions, monthly webinars...etc.

J uses ASCII symbols and has a small community of very intelligent users that
are stats smart, software smart, math smart...etc. It has great bindings to
Lapack, built in graphs (well Dyalog does too) and tutorials called labs. The
community is much smaller though and it doesn't have any parallel primitives.
J is free to use, but the Jd columnar database is commercial, but very
reasonably priced.

Honestly, both are awesome, fun, powerful, and plain cool.

~~~
dman
Thanks - my next sabbatical is going to be Rust + APL

~~~
4thaccount
My usual advice is to also check out Aaron Hsu's talks on YouTube and his
posts on HN (user arcfide I think). Really eye opening and alien stuff.

Dyalog also sells a standard keyboard with the APL symbols printed on the
keys. You might find that interesting.

------
patrickg_zill
Alternatively, you can look at the completely free www.Aplusdev.org, "A+"
language that was also created by Whitney.

There is also GNU APL which I have been playing with and has some good ideas
also, including the ability to create scripts.

~~~
tmcb
I would like to recommend Kona[1] as well. It is an open-source K
implementation, with some small differences.

[1][https://github.com/kevinlawler/kona](https://github.com/kevinlawler/kona)

~~~
patrickg_zill
Thanks for the reminder. I had seen it before, but I now see that it is
active, with the last commit 8 days ago. I compiled it on my Linux box quickly
and will be testing it out...

