Algorithms + Data Structures = Programs - Episode 96: The K Programming Language
Episode Date: September 23, 2022In this episode, Bryce and Conor talk about the K programming language.Link to Episode 96 on WebsiteTwitterADSP: The PodcastConor HoekstraBryce Adelstein LelbachShow NotesDate Recorded: 2022-09-19Date... Released: 2022-09-23Val Programming LanguageJakt Programming LanguageSerenityOsSean Baxter on TwitterOther C++ PodcastsC++ Podcasts Reddit PostK Programming Language/HistoryArrayCastArthur WhitneyAPL Farm DiscordKxQ Programming LanguageQ overQ scanOpen source implementations of KVenn diagram of Array LanguagesAPL Meetup Talk: A Look at Array LanguagesA List of Companies that Use Array Languages (J, K, APL, q)Notation as a Tool of ThoughtKen IversonThe APL MachineQ DictionaryKDB+J’s JdC++ std::bind_front / std::bind_lastBQN Programming LanguageA Programming LanguageA+ Programming LanguageB Programming LanguageJ IncunabulumAPL\? (Introduction of J, before it was called J)Intro Song InfoMiss You by Sarah Jansen https://soundcloud.com/sarahjansenmusicCreative Commons — Attribution 3.0 Unported — CC BY 3.0Free Download / Stream: http://bit.ly/l-miss-youMusic promoted by Audio Library https://youtu.be/iYYxnasvfx8
Transcript
Discussion (0)
and then K9 showed up.
The K7 community, I think,
I don't know really what the state of it is.
So now there's K7,
which at one point had a big community around it,
K4, which is behind Q.
But a community that ended
because this guy unilaterally decided,
oh no, this thing that you're using,
I'm going to delete it and build a better one?
Yes.
This is an interesting software governance model. Welcome to ADSP, the podcast episode 96 recorded
on September 19th, 2022. My name is Connor. Today with my co-host Bryce, we talk about
the K programming language.
Dear listener, it is September 19th, 2022. The last time we recorded was August 15th,
2022. It's been over a month. Much has happened in the last month. I almost died.
Yes, that's right.
And then we met up in New York. and then are we gonna talk about the thing
i think we should do that i think we should talk about that next time because that's gonna require
you're gonna need a good long period of time to to troll me
oh okay yeah so are we allowed to are we it's okay my girlfriend is going through there's going
to be some background noise but you know what that's part of the show you get oh yeah you get
my real life that is um i'm talking away from the mic now so wait are we allowed to give the
listener a preview at least of the thing we said we might talk about hang on hang on hang on is
that the chocolate all right bring me some chocolate i'm leaving that in the episode
there's that's not getting edited out you better be careful about what you say here bryce um
this is poor planning on your part clearly i happen to be uninterrupted for the next 90 well
okay so look look the plan was for me to go up to a different floor
where I could record this.
I only get one.
But I'm going to be honest.
I only really put on underwear today,
and I threw on this exercise shirt.
I just couldn't be bothered to put on clothes
to go upstairs.
Sorry.
Alright, we will
let the listener react to that on the
Twitter forums, etc.
We're going to preview what we're talking about?
We'll mention the topic,
because it is topical.
Drunk Shakespeare.
Oh, no, no, no. That's not even what I was talking about.
What were you talking about?
I was talking about the other thing. The listener is going to be upset if this does,
if now they're going to be like, what were they talking about? The thing that I DM'd you about,
and I said, oh, we're going to be talking about this. And then you replied, all right,
he's got his finger up. I'll let him finish eating his chocolate and then he can respond.
Yeah, I think we should talk about the vowel programming language.
And I heard about this other thing called JA jackst have you heard about that at all it's jackta j-a-k-t so what was that announced uh i mean jack has been a thing dormantly for a while
that exists i believe is it in um andreas andreas clings uh serenity os i think that's where it comes from and they've been
designing this i mean i should look that up yeah serenity os slash jacked a repository
in the serenity os uh github um because that's an org i I'm guessing. Yeah. So, okay.
To answer your question, sure, we should talk about all the new C++ successor languages.
But let's talk about Val today.
And then what I think we should do.
Wait, wait, wait.
We're not hopping in.
We're just talking about what we're going to talk about we're not actually talking about anything yet
so you want to talk about Val today
um
yeah but okay here's my
broader idea
we should bring Sean Baxter on the podcast
to talk about Circle and all these other
new languages because I know he's checked them
all out and also Sean Baxter
is just a fun time
and we can have Sean tell us about Moby Dick I know he's checked them all out. And also, Sean Baxter is just a fun time.
And we can have Sean tell us about Moby Dick,
which is one of Sean's favorite subjects.
So I think that's what we should do.
All right.
So we're not talking about New York today.
We're not talking about how I almost died.
We're not going to talk about all the exciting things that have happened recently.
What we will talk about... Oh, yes, and I was going to mention, all the exciting things that have happened recently. What we will talk about.
Oh, yes.
And I was going to mention you got put on thin ice last time because you were eating when Kate was here.
I'm going to bring Jason on.
I'm going to test him out for a couple episodes.
OK.
And we're going to we're going to see, you know, do I prefer Bryce?
Do I prefer Jason?
And almost almost anybody would be a better co-host
i'm constantly late there's constantly background noise you started off you started off great and
then uh you've just become a lot more did i know you did i mean your mic quality was bad yeah but
uh your uh what do they call it punctualness I'm not even sure if that's the noun version of punctual.
Punctuality? Who knows? But anyways, we're going to try out Jason. What happened though? I can't
remember. You said something that made me think of this. One thing we do have to mention is that
on Reddit a few days ago now, someone asked the question, are there any good podcasts about C++?
Oh, this is too meta.
This is too meta.
And a bunch of people, oh, yeah, that's what happened is that you said something about, oh, you know, it's just the way our podcast operates.
And then made me think about a few of the comments.
So I replied, but I'll read my reply after I scan.
So the top comment was by Jake Arkenstall.
I hope they don't mind that we're calling out their username on Reddit.
And says, for chatty, ADSP is great.
There's a lot off-topic, casual content,
but that's what podcasts usually are.
Thanks, Jake. That's very kind what podcasts usually are. Thanks, Jake.
That's very kind of you to say.
That was generous.
Yeah.
Then someone else, JV Apen, they said about us, and I thought this was the best like six or seven words summary, maybe other than a discussion with Sean Parent, which has become less true seeing as we haven't had him on in 20 episodes or so.
ADSP the podcast,
and then in parentheses, the explanation of us.
Chaos and chatting with sprinkles
of information.
I thought that
was fantastic.
I might add that to the website
as the byline.
Chaos and chatting with sprinkles of information.
Fantastic.
Anyways, I will link this Reddit post because there's lots of good stuff.
I sort of densified everything and added links.
CppCast, CppChat, ADSP, Tooth Compliment, TLB Hit, No Diagnostic Required, and C++ Club.
Didn't actually know about that one, although I managed to listen to all 28 episodes in two days.
Of course you did.
I have a question.
Have we actually talked about the K programming language on this podcast before?
The K programming language?
That's the one that's behind you, right?
No, that's Q.
I mean, they're tightly related.
Have we talked about them before?
It's hard to know.
In the cinematic universe of my podcasts, I've talked a lot about K and Q,
but that's probably mostly been on ArrayCast.
Has it been mentioned?
I mean, actually, there's an easy way to check this.
Well, it might not
mean that we haven't mentioned it but if we go to the tags and we go to is there a k there's a j
but there is no k there's a j and a q on the tags on our website for topics for those of you don't
know forget about vow forget about other things that people are doing i I want you to tell me the story of the K and the Q language,
because if I recall correctly,
this is the programming language that you have often quoted to me as being
one that was sold for some ridiculous large sum of money or that,
that it was the highest price per like,
like the most dollars per byte of program sold or something like that, you said.
Yes, you are correct, like 80%.
Okay.
That's about as much as I want to be correct.
I don't want to be more right than that because that means I spent too much time researching the thing.
I don't ever want to be 80% correct, so tell me more.
So this is true.
At some point way back, I want to say probably in our first 10 episodes,
closing in on 100 here, which is pretty crazy.
It doesn't feel like we've recorded 100 episodes.
But yeah, in our first 10, I think I mentioned at some point that basically
Arthur Whitney, the individual behind many, many programming languages, A, A+, K, K1, K2, K3, K4, K5, K6, K7, K9, and Q.
Okay, hang on just for a second.
All those K languages you just listed, are those evolutions of the same language?
No. Okay. All right. all those k languages you just listed are those evolutions of the same language no okay all right can i assume we'll hear more about that later but continue well i can quickly because i had the exact same thought i actually met with the last flight i
took before the pandemic was not actually to prague which was in february of 2020. It was to New York at the tail end of February in 2020.
And that was to meet with...
I can't be upset, Wilsoner, about this trip
because I did not live in New York at the time.
This is true. Very true.
But yeah, I flew to sort of meet with Arthur Whitney
and got to have a bunch of conversations with him
and a dinner with him.
And at one point, I didn't even ask a question, but I said something about K's just being like, you know, versions of each other or evolutions.
Similar to many other, you know, languages.
You could even say C++ with the different versions, etc.
And he corrected me and said they're not, you know, evolutions of the same.
I'm not sure if evolution, I use the word evolution.
I'm not sure what he would say to that.
But he said they're definitely not versions.
It's not like K3 was an upgrade from K2.
They are complete rewrites from scratch.
Every single time Arthur creates a new language, he deletes, like straight up deletes. You can't go and find the old executables
for K5, 6, and 7 unless if you happen to have downloaded it in the past. And maybe you can
find them in the corner of some internet. He just like wipes it off of his computer and then starts
from scratch writing a parser, lexer, etc. And admittedly, takes what he, you know, there's the
quote that, you know, now that I finished programming this project, I can go back to the beginning and do it the right way because you learn.
Okay, but what if you were using the older version of the K language?
So there are going to be a number of listeners that listen to both ArrayCast and ADSP that are going to have strong thoughts on this, because this is a question that I've asked the K community literally just within the last month, maybe a month ago,
I went to the APL farm, which is a discord that has channels for all the different sort of
Iversonian array languages, J BQN, K, uh, Niel. Not sure if I, did I miss them all? APL, BQN,
J K and Niel, I think are the five main ones.
And I went to the K, I don't spend much time in the K channel, because it's one of the
Ray languages that I know the least about. And I asked, what is, what is like the state of K?
Because every time Arthur starts on a new K, he just like deletes everything off his computer
and starts a new. And if you're
wondering why did they skip K eight? That's because I was wondering that I was about to ask
what happened to K. Do you know? Do you have a guess? I know some of our listeners that work.
Isn't that like the acronym for like Kubernetes or exactly? Yeah. So they didn't want to, you know,
hop, step on the toes of Google, even if it would have been fine, because no one cares. So they and some people say that they kind of wanted to get to K nine, because want to, you know, hop, step on the toes of Google, even if it would have been fine because no one cares.
So they and some people say that they kind of wanted to get to K9 because it's, you know, whatever, cute.
But yeah, woof woof. Oh, yeah. Hang on. Hang on. I got it. You continue. I got to get my dog.
I'll continue talking. Yes. So every time Arthur starts a K, he starts a new one, which sort of leaves the prior K in a state of limbo.
And so it's unclear to me what K is the most popular K or the most widely used, or if someone's
going to start learning K, what should they start learning? So the most recent, you might say,
oh, the most recent one is obviously the most recent one. But there's always a stage where it's sort of in development.
And the current K, K9, has kind of been branded Shakti.
And there's been a database in a company.
Or do you want to have a woof woof break for Looney?
Hey, Looney.
Can you say K9 again?
K9.
K9.
And that kind of got picked up.
Looney and I got to meet in New York.
You'll hear about that
in our new york recap episode which apparently we need more more time for in the future
but yeah so it's okay nine every k gets abandoned at some point and so of the
of the k's in my mind your options are k4 because that's the K that went on to become Q.
But the problem is that the company that bought KX, the company, which is the company that owned K4 and Q, doesn't have documentation for K4.
And apparently there's some command that you have to turn on in order to enable K4.
So K, similar to J j is an ascii based
array language so your functions and your operations are single ascii characters um but when
first derivatives the company that bought kx bought the company single ask you mean
combinations of ascii characters like single i think there are certain digraphs which is two
ASCII characters together but most of the functions and operations are single ASCII characters which
means I think on one of the Arraycast episodes it was either Stephen Apter or Joel Kaplan said
what is Arthur's main motivation for designing. Hang on. I'm sorry. This is, are you allowed to define a function that has a multi-character name?
Oh, yes.
Correct.
Yes.
Definitely.
Okay.
Yes.
Actually, I don't know much about K, so I could be wrong, but like I'm 99% sure that
is the case.
But all of the built-in functions that come with the language are ASCII characters.
That makes more sense.
Similar to how all the built-ins in apl are unicode characters okay but to finish my last thought um uh joel or steven
whichever one it was said you know arthur's main motivation for designing k and his prior array
languages is the keyboard because it's what is available to you on the keyboard in terms of
symbols uh is what you can use anyway so the the point I'm going on a long-winded thing of like,
what is the state of K?
It's a question I asked, and in my mind, it's K4, the language behind Q.
The problem with that is that it's not documented on the KX website
where you can learn about Q.
Q is very well documented, just not K.
And Q is the wordified version.
So whereas, you know, slash is sort of a reduction in K, the wordified version of that is
over. And the backslash, which is a scan, the wordified version of that is scan. Anyway, so
instead of ASCII symbols, KX and Arthur put sort of words on it, that became Q. And then for a long
time, K7 looked like it was going to be like sort of the k for the end of
all times and there was wikis built around that k and there was a big community but then when k7
sort of got ended uh and then k9 showed up the k7 community i think i don't i don't know really
what the state of it is so now there's there's k7 which at one point had a big community around it
k4 which is behind but a community that ended because this guy unilaterally
decided oh no this thing that you're using i'm gonna delete it and build a better one yes and
and so like i'm not i don't think this is an interesting software governance model i don't i
don't i don't think arthur listens to this and i if he does or this reaches his ears, I don't want this to come across because I have a huge amount of respect for Arthur.
The man is a genius.
I have a huge amount of respect for him because you have a huge amount of respect for him.
I'm just like, as somebody that comes from a more traditional software community, I just don't like i'm just trying to understand like it's it's it sounds it
sounds really out there to me but i'm sure that for folks in the community and for arthur that
like there's there's good reasons and probably makes sense it's just like i don't understand
it yet so the reason i was prefacing i have a lot of respect is because I'm about to say something that's kind of critical.
It's not for anything you said.
It's for what I'm about to say.
And that's that I think the biggest problem with the K languages is that that is what Arthur does.
He basically starts anew and then you end up with this language that is better than the prior ones. But not only does he sort of delete everything off his computer
and then to a certain extent, whether abandon is the right word to use,
abandon the community, he also infamously does not like to give interviews
and does not like to document sort of the history of things.
So there is, I have this, I'll link it in the show notes
and I can even read a little bit of it.
So we've never get him on the podcast?
No, I mean, we I'll link it in the show notes and I can even read a little bit of it. So we've never did him on the podcast? No.
I mean, we've asked on a Raycast.
I mean, there's a chance that like in the right sort of setup, he might be willing to give an interview.
Like I'm not writing it off, but like we've definitely extended the offer.
But you haven't explained why.
Why?
If the language is like, yes.
Why does he,
why does he delete and then start over?
I mean, if you gave a lot of people the opportunity
to do that with their software projects,
there was a ton of people that,
given the resources and time,
would definitely say, yes, let's do it.
I mean, I think there's always time would definitely say, yes, let's do it. I mean, I think
there's always the, the adage of like people underestimate how much work it is to do a rewrite.
And so I'm like, I'm sort of put that aside. I realized that it's a ton of work, but like
how many people, if you ask them, could, if you had the ability to go back and do it over again,
do you think you could do it better? Would that be something you're interested in? Like a ton of
folks would say yes to that. And Arthur has the means to do that. Like he's a brilliant, like probably one of the top end developers in the world.
He basically does, I think, most of the work on his own.
He's responsible for one of the fastest languages in the world.
His company that he sold, he sold for $100 million in two different installments once in 2013 and then fully in 2018. And people like the banks that use Q and KDB Plus, which are
sort of the database and wordified version of K that he built, pay a million dollars a year to
use the language. And like every, almost every, like when I asked like how many firms on Wall
Street use this to someone that I met with in New York he said almost almost everyone like it's it is a it is like the go-to language and
so like Arthur built this incredibly powerful tool where performance was the only thing that mattered
and people put up with the you know terseness and the fact that it was ASCII symbols and if you put
some expression it looks crazy because the people that were purchasing it don't care about programming languages and what it looks like.
They care about making money on Wall Street and doing real-time things that need to be done extremely, extremely quickly.
Is it statically compiled?
It's interpreted.
It's interpreted?
Yes, which shocks a lot of people.
People say interpreted languages can't be fast because when people hear about interpreted languages, they think about Python.
But if you write an incredibly, you know, fast, you know, I don't even know what goes into K.
You know, I don't want to start saying things.
Do you know how it's compiled?
Is it compiled to a bytecode or what?
I think it's just a single sort of executable.
It's written in C, very low-level code. I mean, like you say, it's interpreted, but does it compile the language to a bytecode that then gets run through some bytecode interpreter?
I do not know, but I don't think this is a bytecode.
That's more like something like Python.
It's like.pyc files that get left behind are the bytecode compiler.
If my understanding is correct, and I'm sure we have a number of listeners that will immediately correct me, feel free to DM me or comment on a Twitter thread or open up a GitHub issue.
It's just that each of the primitives have like some specialized code for all the different types.
And it's able to recognize quickly if you're operating then dispatch to that statically compiled operation, like previously compiled.
So like it is interpreted, but is essentially just ends up invoking specialized, very, very fast code.
But I could be wrong about that.
Like, I don't, I don't.
But that's how the built-ins work.
Yes.
Okay.
Anyways.
So, so the so why i mean he sold the company for and i think even before he was working on k he did very very well at morgan stanley when he was building a and a plus which
were basically predecessors to k and a and they were he those were called apls just basically like
ascii versions of um apl which he had learned originally when he worked
for IP Sharp and Associates. And yeah, like, so if you go to this history of K page, it says that
Arthur Whitney left IP Sharp and Associates in 1992 to create a new language. This was formed,
they formed KX Systems. And K2 and K3, K2 and K3 were first commercially developed and supported
versions of K made at KX Systems. K3
came with a complete reference manual that consisted of documentation. KDB Plus was a
database system that was sold along with K that provided an in-memory database manageable by K.
K4 was released in 2000. It actually says 200, so it's missing a zero. In 2003, along with K4,
Q was released as a wrapper around k providing
readability k4 is the current commercial dialect supported by kx systems which is bundled alongside
q k4 requires a command to switch from k to q and the documentation at code.kx.com does not cover k4
and then shakti which interestingly now says K7, K9.
It was my understanding that the branding of Shakti didn't come out until K9,
but maybe they have retroactively sort of included K7.
And it says,
Arthur Whitney sold the majority of his stake in KX Systems in 2018 and departed along with a few of his associates to create the new company called Shakti,
along with which came the creation and development of the K7 and K9 dialects.
K7 was maintained for a few years and is no longer available for use.
K9 is currently nascent and, as per on-site claims,
supports fast processing of tables with row numbers in the billions and trillions.
Binaries for K9 are available at Shakti.com.
So, and yeah, when I asked the k channel on the apl
discord what's the state of k i got sort of varying answers of i'm learning k6 you can find
a bunch of open source implementations of the different k's so there's kona there's ok but
these are all just implementations by individuals not the actual executable that was released by Arthur
when he was developing it.
Because like I said, he deletes them
after he's done using them.
And yeah, I mean, I find K incredibly,
the story of K and Q and R.
So these are not open source.
So when you say he deletes them,
like you mean he deletes like his source
and he deletes the binary or he just deletes his source?
That is my understanding.
And that's what he told me.
And that's what he's told many people.
Wow.
Yeah.
Wow.
And, yeah, I mean, if you're wondering, sort of, if you listen to a Raycast, you know, why do I like APL?
I talk about APL and BQN. Those are probably my
two favorite languages. I created this Venn diagram, which I'm sure a few of our listeners
that follow me on Twitter have seen, of sort of the delineation between Array languages and
Iversonian languages. And then also there's a circle for combinator languages. And K and Q
don't really have support for combinators.
And that's like 50% of what I love about array languages.
So in order to do a lot of the things that I can do in APL and BQN,
and even JJ has rich support for combinators as well.
I can't replicate that code in a Q and Q and K.
What,
what has made these array languages, this K family, so much more successful than other array languages?
Well, so actually, I released...
So, we're going back.
We're hopping in.
If you don't listen to ArrayCast, I'm just keep on bringing up things that have been mentioned there.
But so there was two meetups that happened, one in Toronto, one in New York.
And that was the reason Bryce and I got to meet up was because I was down there for this
meetup.
And I released the presentation of that, the re-recording on YouTube.
And one of the comments I got was, why would you learn Q?
Because I was including Q in my sort of, it was a comparison of seven different array
languages.
And I added Q at the last minute for the YouTube recording version and this comment was why are you covering q it's a proprietary
language that you need to like hand over your email to use and only then you get like a version
that has limited cores you have to limit your cores to like two or four or something like that
and uh i said and then i basically linked to this history page and I said, or I linked actually to a GitHub repo that tracks the number of companies that are using array languages.
So J, APL, and like K and Q and KDB plus.
And I tallied it.
There were 21 using APL and 25 using K, Q or KDB plus.
And which is all the same thing.
People write it down differently.
So four more, then we're listed.
And obviously, this is not an exhaustive list.
Okay, so I'm going to...
Let's just go on the premise that K is successful
because from everything I've heard,
it sounds like it is.
Why?
Perf.
That would be my one word answer.
I don't think APL... and to say that people that use apl
don't care about perf is i don't think true in all cases that's interesting so that that sort of
that sort of means like for me to really understand this i you're the one person
i need to talk to somebody who understands how this thing how this thing is so fast
i mean i'm not sure how many people in the world
know how K is so fast
because there's only one person that works on the source code
and that's Arthur Whitney.
Yeah, but no, people must have figured out a bit
about how this thing operates.
Yeah, maybe.
I mean, I'm not sure how many of the wall street folks that are using k
and q i mean we can get on i met up with the individual that uses k we can invite them on and
i mean we're also supposed to have marshall on i said a while ago a lot of people on
and we don't always deliver on that um but but i i find find it interesting that if really if the differentiator is performance,
my guess would be that it's not just that, it's not just in the implementation. There must be
aspects of the K language that make it easier to compile, to interpret efficiently
as composed to other languages.
I just think that the way it's implemented,
it's like the executable is incredibly tiny.
I mean, I think it's larger now probably.
But what I'm saying is that,
no, I'm suggesting that the design of the language,
this need for performance has probably influenced the design of the language, this need for performance
has probably influenced the design of the language.
Like if APL has been around for a long time,
if people could make a faster APL,
they probably would have, right?
I don't agree with that, no.
Why not?
I think, so there will be people that disagree with me.
I've said this statement to several people.
Some people have completely agreed.
Other people would say that's not the case at all.
So just let it be said that varying opinions on this statement.
But originally, APL was not a programming language.
It was a notation for teaching.
And that's what Ken Iverson,
the person that created the notation,
it was called Iverson Notation,
cared about.
He cared about being a tool for teaching.
That's why his paper,
when he won the Turing Award in 1979,
was called Notation as a Tool of Thought.
And it's my impression
from all the papers that I've read about Ken
and his work with education
is that he actually didn't
care about performance. It doesn't mean he didn't necessarily think it was important at the end of
the day, but like when he was designing J and designing APL, he was thinking about how this
affects the way people think, not about how fast is this going to run. And because of that, a large
percentage of the array language community, when it comes to APL and J don't care about perf. They
care about it as a desktop calculator that can do way more than just, you know, integer arithmetic,
but can do stuff with, you know, CSV files. And if you need to do something super quickly, it's,
you know, a super good quote unquote tool of thought tool. That being said, I think there
are people that do care about perf and I think DialogAPL has done an incredible amount of work optimizing idiom recognition and stuff.
But to say that someone could just, oh, if someone could create a faster APL, it would have been done.
I don't, because I agree, except that it wasn't done, other than maybe, like, the APL that we're talking about is K.
Perhaps it wasn't done because of things inherent to the design of the language.
You're acting as if the language of APL and the language of K are just interchangeable things.
And if the design of the language has no impact on performance, the design of the language definitely has impact on performance. The design language definitely has impact and performance. Now, I'm just not
qualified to tell you what different design decisions in K versus APL has performance
impact because I just don't know enough about those languages. Well, I do know that one of
the things that Arthur is famous for saying is there is no operation in the language that's
10 times slower than any other operation.
So every operation is within an order of magnitude.
Because in the past, there's been attempts to write high-performance APL machines.
I'll link it in the show notes if people want to read about it.
But they implemented these extremely fast primitives.
But when you ran whole programs, the primitives would be really fast,
but you'd spend 99% of your time in these operations that weren't weren't critical how does apl differ from k well the the number one thing is one's
unicode one's ascii but you can kind of ignore that yeah the second thing is that my and i'm
sort of once again people can correct me i'm not a kid and for the record i don't think that the
the uh the choice of unicode some symbols for uh apl syntax i do not believe that has any
any real impact on the uh the speed with which you can interpret the program um probably not
but in in line with what i said earlier about ken it does impact the tool of thought which is why i
bring it up because it's much harder for an ASCII symbol to be visually representative or numomic.
How do you pronounce that?
Of the operation than it is for a Unicode symbol that's like tailored.
The second thing is that K and Q don't have true higher dimensional arrays, and they also don't have a rank operator. They do have the concept of rank, but I think the primary data structure is an array. But also second to that is something
called a table, I believe, or dictionary. I'm going to mess up what it's actually called,
but it's more of a hash map of vectors where each of the values is a vector that doesn't
necessarily have to have the same length.
And so you do a lot more with hash maps than you do in other array languages,
because hash maps don't exist in other array languages.
So things like querying and the database.
So that's the other thing is KDB+.
The K language and Q language come with an incredibly powerful database.
And I think it specifically has like a ton of functionality for time series
stuff, which obviously if you're on wall street is stuff you want to do. And there is a database
that comes with J called JD, I believe, which is kind of supposed to be in the similar vein is what
KDB plus does. But yeah, in APL, there are databases, flip DB, stuff like that, but like
nothing that was built, like
tailor-made for high-frequency Wall Street stuff.
So the existence of dictionaries, and also, too, I've talked to a few people, Michael
Higginson, who just won the APL professional tier of the APL contest, and another individual.
And these folks have been telling me how I need you know, I need to learn more about KNQ
so I can speak because there's a bunch of stuff.
Like I think one of the things that Michael mentioned,
and I apologize, Michael, if I'm going to get this wrong,
but he mentioned that you can have,
well, so actually this is something I know for a fact
that I didn't get from Michael's,
that most of the functions in J, APL, BQN
are limited to sort of two arguments,
unary function and binary function.
And when you want to have multiple arguments,
I believe the idiomatic thing
is to sort of chain them into a list of things
and then destructure them.
So really you've got unary and binary.
Whereas in K, you can have any arity functions.
They've got a syntax for basically a function
and then it's defined by braces.
And then at the front of it, you put in brackets
and then you just separate with semicolons all of your arguments. So if you want to have a function
with five arguments, you just go A, B, C, D, E. And you can do basically, and this is the thing
that Michael told me, he says you can, I can't remember if it's called like modifying the valence,
but if you basically want to do partial application to any of the arguments. So similar in C++ when
we have, you know, bind front or bind last or before we had
those two, we had bind. You had those like underscore one, underscore two to place the
placeholders for the variables that you would want to take from the return function. There's
a super convenient syntax for that where basically you can do partial application for it. So if you
have a five argument function and you want to turn that into a three argument function with the first, third, and fifth arguments, that's super simple to do.
You basically just like fill them in and you have first class functions.
That's another thing that KNQ have, whereas APL and J don't.
They have first class functions.
Wait, APL doesn't have first class functions?
No.
It has defunds, which are similar to lambdas a bit of an odd
i mean you got to remember apl was created in 1960 well first implementation was in 1966
and bqn the newest iversonian apl language does have first class functions and is much more functional in a number of ways.
Yeah.
We should either have some of the Q folks that I've talked to,
we should bring on Michael,
or I should go, I'm thinking,
so here's, I was going to tease this on a Raycast, but maybe I'll just say it here.
I mean, I was going to, but then I left it out,
but I'm thinking about,
because we've been sort of on a break,
my programming language is a virtual meetup for the last couple months since July.
And I'm thinking about the next book, just being a dictator and choosing it,
usually there's a vote, and making it Q for Mortals,
which is a book that's on the KX website for learning Q.
And once I get through that book, I'll be much more informed well i know how
the implementation and why the language is so fast i'm not sure but yeah we're at like the
i don't know 30 minute mark the brisket is was at 166 when i last chucked which was about
two minutes ago you got until the brisket's at about 180 and then I really got to watch it.
Well, I mean, what else do you want to know about
K slash Q? I mean, we basically
kind of covered it. ASCII language, dictionaries.
Okay, but you said you created some other languages.
Oh, yeah. Well, I mentioned
A, A+. That was when he was at Morgan Stanley.
He left...
Well, actually, it says on this history
page that Whitney left IP Sharpen
Associates in 1992.
I thought he left IP Sharpen Associates to go to Morgan Stanley.
And then he worked at Morgan Stanley for a year.
And then I thought actually maybe he even worked at another bank before he started KX.
But regardless, he worked at a couple banks at some point, worked at IP Sharpen Associates.
And when he was at the banks is when I thought he was working on A and A+.
He also wrote a language called B, which is actually open source and online.
I'll find a link to it, throw it in the show notes.
And you'll get a taste for the style of C code, which is very similar to the way that
J is programmed, which is open source, which is very, very macro heavy.
I think when I was working on the J source code,
trying to port it to C++,
I measured and there was like 10,000 macros.
So they, and they, it's not like,
oh, macros, the way we use them in C,
like they create macros for everything.
And then you program in macros, basically,
like for a dyadic or a monadic function,
AKA a unary function or a binary function,
they have V1 and V2.
And that's how you define a function
that has one or two variables.
For four loops, they've got everything.
So everything is a macro.
And I think that's similar to how
Arthur Whitney has designed his...
And famously, there's something called the incannabulum,
which is actually a word that means a book before it's a book or something.
And it's called the J incannabulum.
And Ken Iverson wanted Arthur Whitney to work on J with him
when basically Ken decided we're done with APL.
We're done with Unicode symbols.
We've tried for three decades.
Unfortunately, they didn't wait for like five more years when like unicode became a thing and so they switched
to i do not think that unicode becoming the thing would have substantially improved the likelihood
of apl seeing widespread adoption you know we'll never know but the point is is that it's a lot
the state of unicode support in software in general in 2022 that's because
you're a c++ programmer does no it's not a c++ specific problem the state of unicode support
just across software in general does not lead me to believe that the world even today is ready for
a language that leans so heavily on unicode uh yeah i mean it's a fair
take it's a fair take um but yeah so when ken was starting work on his new language j aka apl 2.0
and even there's a presentation i'm not sure if it's recorded and online but i definitely know
the slide deck is something and i believe it it's called APL question mark or something.
And it's this presentation of this new, quote unquote, it was called an APL at the time,
but just not with Unicode symbols.
And he was presenting it at an APL conference.
And kind of everyone was like, whoa, whoa, whoa, you're calling this an APL?
This isn't an APL.
You know, to the guy who invented the whole thing.
Anyways, he went to Ken, or sorry, he went
to Arthur to ask him to work on it. Arthur said, no, I've got my own plans, aka A plus, you know,
K. And, or at that point, maybe he had already done A and A plus, and he was about to go on to K.
But he went to this farm, and there's a Wikipedia page that explains this whole thing. And so even
though he was telling Ken, no, he said, I'll get get you started and he wrote this single page of j
code and um that was basically the start of the j programming language and it's called the j
incannabulum i believe as i pronounce it um why um okay so he created a a plus b and why did go to k
like like oh like what's the name?
Yes, alphabetically.
Like, why?
So A was clearly short just for A+.
And Array Language
loves their single-letter stuff.
So APL was just a single-letter version of APL.
And then...
Sorry, A is a single-letter of APL.
A+, is because they added
a gui to a so a plus is just a with a gui b follows pretty clearly yeah but then c was taken
okay what about d uh not taken at that time i don't think d was taken at the time what about e
yeah i don't i don't know about that but so i think at that time j actually i don't know about that. But so I think at that time, Jay, actually, I don't know if Kay got named first or Jay after.
But the reason Jay was chosen was because when they were starting on the language and doing work, Roger Hui, the main implementer on it, was told to, like, get started or whatever.
And so he just named the file.
If you look at your keyboard, if you're sitting in front of a computer right now which probably none of you are what letter on your keyboard has a
little thing that you put your index finger next finger is resting so it was
just the easiest letter to type so he just saved his file is like j.c and then
that's what the name of the language became why K I actually don't know I
don't think you know cake oh. The array programming language historian.
A rare falter.
All right.
You look that up.
I'm going to check on the brisket.
We are getting there.
171.3.
This is great.
Great podcast content.
I was going to say, I'm on the KAPLwiki.com page,
and it says, this does not answer the question,
but I just learned something.
K7, the first Shakti K,
was the first K to have full Unicode support.
Oh, then not in terms of Unicode characters.
So he sold, he creates his company.
Chris's company?
Who's Chris? No, he creates this company. he sells company who's chris no he creates this company
oh creates okay then he sell then it becomes you know big and popular then he sells it
then he goes off and keeps making new k languages yes correct i think he collected
40 million in 2013.
Were the people who bought this company from him perhaps not thrilled about this?
Oh, yeah, probably not.
Probably not.
I mean, I have not talked to anyone directly at first derivatives about how do you feel about Arthur continuing to do exactly what he was doing before? But I would imagine that they would have probably been happier if he had just retired.
Also, too, someone corrected me when I was in New York, said that, you know, it's not Arthur didn't own 100 percent of the company.
So he didn't. And he sold the company for 100 million.
But there was obviously other shareholders and stuff.
So he he got a percentage of 100 million, which I said, you know, does that matter?
Like $40 million, $100 million?
Those two are the same number to me.
And he was like, you're clearly not from New York, all right, you know?
Thanks for listening.
We hope you enjoyed and have a great day.