Algorithms + Data Structures = Programs - Episode 273: Recreational Algorithms, 一百四十一, PEDMAS & Orwell
Episode Date: February 13, 2026In this episode, Conor and Ben chat about recreational algorithms, the Chinese number system, PEDMAS, George Orwell and more!Link to Episode 273 on WebsiteDiscuss this episode, leave a comment, or ask... a question (on GitHub)SocialsADSP: The Podcast: TwitterConor Hoekstra: LinkTree / BioBen Deane: Twitter | BlueSkyShow NotesDate Recorded: 2026-02-04Date Released: 2026-02-13ADSP Episode 247: The Philosophy of Good Software DesignHoogle Translate scanHoogle Translate filterHoogle Translate adjacent_differenceHoogle Translate deltasQ differPEDMASKeynote: A Future of Value Semantics and Generic Programming Part 1 - Dave Abrahams - CppNow 2022Intro 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)
Does that mean this thing is going to be a function?
Maybe.
Does it mean it's going to be a function template?
Is it going to be a Lambda?
Is it going to be a variable template lambda or a generic Lambda?
These are all possibilities that I don't know and I don't really care at the point
where I'm just thinking about the API.
So at some level, I have to just play with the API, not really.
Of course I have, like I said, some idea of what's implementable and what's not.
but sometimes I just, there's a problem and I want it to be a certain way.
And I don't know yet whether I can actually implement that, right?
But I write the API that way anyway, and then I have to play around to see what's possible.
Welcome to ADSP, the podcast, episode 273 recorded on February 4, 20206.
My name is Connor, and today with my co-host, Ben, we chat about recreational algorithms,
the Chinese number system, pedmas, George Orwell, and more.
And sometimes you're playing around, you know, I play around a lot just to, because most of the code I write, a lot of the code I write, I'm very concerned with writing APIs, right? And I want to make the APIs good. I want to make them easy to use. I want to make them sort of natural. I want my team to have a easy time and a good time using them and not have any pitfalls, right? And so I think about how to structure APIs. And I'd like to write wishful thinking code, right?
I start out writing the client code for the API, if you like, right?
I'm like, what do I want the calling code to look like?
And at that point, I am not really concerned with,
I'm much less concerned with what's actually possible
than what I want it to look like, right?
I'm not concerned with thinking about the implementation
so much as thinking about the API at that point.
And I just sort of have to trust sometimes that it'll be implement.
implementable, right? And so I'm making decisions like, or making choices and sort of observations
about things like, well, when I call this, is what I call it with going to be available?
At compile time or at runtime, is it going to be something on the past a template argument
or a regular function argument? Do I want it to, you know, and I sort of have in my mind a ton
of sort of implementation toolkit, if you like. But there's things like, you know, I'm calling
this thing. Does that mean?
mean this thing is going to be a function, maybe? Does it mean it's going to be a function template?
Is it going to be a Lambda? Is it going to be a variable template lambda or a generic lambda?
These are all possibilities that I don't know and I don't really care at the point where I'm
just thinking about the API. So at some level I have to just play with the API, not really, you know,
of course I have, like I said, some idea of what's implementable and what's not. But sometimes I just
there's a problem and I want it to be a certain way
and I don't know yet whether I can actually implement that.
But I write the API that way anyway
and then I have to play around to see what's possible.
In C++, this really is the great thing, right?
There are tons of ways to implement anything
and there are lots of concerns and trade-offs
and things you might want to do.
And a lot of times you just have to play
to find the right formulation,
especially, I think, when it comes to APIs.
So is that a form of recreational algorithms
when you're playing around with an API,
or is that different kind of, like, playful?
Yeah, I don't know.
To me, it's all kind of the same thing,
but, you know, it's not really algorithms in a sense.
Most of my day job doesn't involve number crunching these days.
I do almost exclusively I.O., right?
So it's just like, you know, every computer program does two things.
Mathematics and I.O.
Well, almost every.
Some only do I.O.
Once that only do mathematics are efficient heaters, I suppose, or not very efficient heaters, maybe.
But at the end, you have to do a bunch of algorithms until you get the data into a form you want to print out.
You know, some programs do that.
But the programs I write on embedded systems almost do 95% IO.
Not very much mathematics.
they're all about shunting signals around.
I see.
So that's why you're focusing mostly on API design at that point.
It's not.
Yeah, that's what I do most of the time these days.
And what informs, I guess, in that vein,
what you want your API to look like.
This kind of gets back to the philosophy of software design episodes we had
where we were talking about, you know,
I think for you, you maybe have a more articulated list of things in your head
Whereas for me, I don't even realize they're there until someone asks me some specific
question and then I'm actually, well, there's like five different things that I'm checking
off in my head, but I...
Yeah, there's a whole laundry list, right?
All kinds of things.
Like, you know, at some level, definitely machine sympathy comes into API design, right?
You don't want to knowingly create an API which is pessimal.
You want to have a chance of being optimal.
So there's some of that, right?
Of course, that comes in C++, because that's the...
reason why we write C++. Also, you know, domain sympathy, right? People coming to this with
domain knowledge. You want to use the terms they're familiar with. You want to use them in the way
they're familiar with. You don't, you don't, it's rare that you can come to a domain, just impose
your own fresh view on it with all their own new terms and have people embrace that. People still
complain about the UI in Git, for example, right? Does Git have a UI?
Are we talking about like the...
No, I'm totally...
Well, yes, it has a...
Not a graphical user interface, but as a user interface, yeah.
I guess the six or seven Git commands that I, like,
build my whole Git world off of are just terminal commands,
and then every once in a while it shows me some, like, hashes or whatever, but...
And at this point, you know, your own experience,
Git user, and so am I.
We don't think twice about it.
But, you know, in 2005, when we'd been using whatever...
Perforce, Alien Brain, Source, Safe, even, you know,
subversion, Git comes along and suddenly we're like, wait, that's not what checkout means.
That's not what these terms mean.
Git kind of redefined them all, and we had to relearn the Git way, right?
I'm just saying that, you know, now in the case of Git, it was perhaps such a, such a sea change
in source control that that worked.
But people still did complain about it, and people still, you know, people think,
Git has a poor user interface.
So anyway, that was all to say that you want to be sympathetic to the domain you're in,
usually when crafting APIs.
Yeah, I mean, I completely agree with that.
But then it's like you said, just bringing up the, do you want to reinvent the world?
Like, you know, the classic one is people complain about filter as an algorithm name or scan.
Oh, yeah.
Well, filter, does it mean, because does it mean positively or negatively?
Is that that?
Yeah.
And some languages, I think, I don't know.
It's either Scala or a Kotlin have literally like they have filter,
but then they also have like alias for that called filter in,
and then they have another filter out.
Right.
But like my kind of argument is like,
well,
when 98% of the programming languages out there agree on what filter means,
you just have to kind of go with it.
And it's less of a strong argument for scan,
but most languages call,
you know, cumulative folder reduction a scan.
And so even though it,
really is a terrible name. Like, scanning is much better for some kind of I.O. thing, which is what Java,
they have like a scanner dot class that gets used all over the place.
Oh, since we're on the subject things, I remember, so now I remember from your last podcast,
you complained about the name of adjacent difference because, and that struck me as
interesting because would you complain the same about partial sum? Yes. Okay. But then I thought,
we are much more, well, I am much more, maybe you aren't,
I am more willing to accept the idea of sum,
meaning generic sum.
Yes.
And therefore, I'm also willing to accept the idea of difference
meaning generic difference.
But maybe you are different to me there.
Well, I mean, just notably, you are the reason for,
well, I mean, are you the sole reason, or, you know, 80% or whatever?
But, I mean, I've brought this up multiple times on 80%.
that it was our conversation back in 2019 at C++ now.
You were the one that pointed out to me that you didn't actually, I don't think, say my exact
words of like encoding difference into the name is bad, but you pointed out that you could
calculate Fibonacci numbers with adjacent difference.
And then like I froze and I was like, no, you can't.
And this was before I had given my talk.
And then that like it led, I think it was 24 hours or 48 hours before my talk.
And then I went and added like a whole four slides and then referenced that.
And I was like, this is terrible.
Like, literally the name has prevented me.
It provided a barrier that I was not able to hop over.
And I'm sure many other people have.
And it's tradeoff too, right?
Do you, like, it became my view and is still my view that you should not bundle a default
binary operation with a generic algorithm.
That is my, and you can provide specializations.
Like, I like what Q does.
They have different deltas, which are, you know, minus adjacent difference.
not equal adjacent difference.
It's fine to provide specialized versions under different names,
but I prefer the generic version.
However, that is a harder thing to learn because you don't get like a working algorithm right off the bat.
You have to go and figure out, oh, I got to go at a stud colon colon plus or a Lambda,
which is like there's studies done that show that like Chinese kids learning Chinese master their numbering system faster
because all of their numbers from zero to 10.
The way you say the number is the number.
Yeah.
And it's also monosyllabic is the reason.
So, like, kids trip up on seven in English because it's two syllables.
And it takes longer to learn disyllabic words than it is to learn monosyllabic words.
What about numbers in French?
I mean, you're in Canada.
You know some French, right?
Numbers in French are very interesting.
Have I ever whined?
We may be going on a little tangent here.
So, for those that don't know, I lived in China for over a year.
It used to speak decently fluent Mandarin.
And, you know, there's a quote.
And I think it is actually about languages, not programming languages.
That is, if you don't know one language until you know two and people have like reapplied
that to programming languages.
But boy, oh boy, is that a true quote when it applies to languages.
I didn't understand how horrific a language English is, especially when it comes to the
numbering system.
And I apologize if I've told this story on this podcast before.
But like the Chinese numbering system is perfect, is perfect.
I love it.
I love it, folks.
You've got zero to 10, you've got 100, you've got 1,000, and you've got 10,000.
Everything else is math.
And you're probably thinking, if you're an English speaker, which I assume most of our listeners are, I mean, that's...
Hold on, hold on, hold on.
You said it's perfect, but then you also said it's base 10.
Is that?
I mean, that makes sense for humans.
Well, computers are base two.
And, you know, I've been told that the optimal base is.
base E.
I've heard base six, I've heard base two.
I've never heard base E.
That's the first time.
What's the argument for base E?
Walter Brown had a lightning talk
where he recounts
the anecdote where he
met
I, no, I'm
hopefully I'll get this.
I think it was JV. Atanasoff.
I think.
Certainly someone from the early days of computing,
some luminary that you would have heard of
some name you would have heard of.
And what?
Walter being, I suppose, I don't know, an undergrad at the time, impertinently, somewhat impertinently, in his own words, asked why base two? Because, you know, back in the day, back in the 60s, it was, you know, it's not something we think about today, but it was a very valid question. Why did we go with base two? Why not, for example, I think some base three machines were, were around maybe, or certainly thought of, but everything now is, of course, base two. So anyway, he asked the question, which was perhaps a valid question, although in his
own words, slightly important.
And the reply was that it's a practical base to make machines from, right?
And it's close enough to, and it's actually pretty good.
But it's not optimal in terms of information theory, base E would be optimal apparently.
It would be optimal based on information theory.
Like, I got to say, I'm not smart enough to even know what that means.
And also, too, I can't even conceptualize like base E.
What I don't even, because the only bases I know.
are like discrete integers.
I don't actually know what does it mean to be irrational.
You just, you have your units column, you have your X's column, your X squared's column,
you know, you still have the place value system.
You just, your, your base is different at all.
Interesting.
Have you ever studied like base minus two?
Negative bases?
Have you read John Conway at all?
This is, maybe I'm reading.
I'm showing my, what do you call it, lack of, the lack of depth of my,
books that I've read here now
compared to you.
But this is just,
you know,
this is an example
of recreational mathematics.
This is,
let's make great,
what's great about recreational mathematics
to bring it back to that.
Oh, right.
Anyway, so, yeah,
Chinese numbers are very good.
Let's say,
better than English.
If not perfect,
very good
for some situations anyway.
And the reason is,
is it's just math.
It's just math, folks.
And like I said,
some of you might be thinking,
what do you mean?
English is just math too.
No.
most of the time it's math you know if you want to say the number 141 it's 100 40 and it's like
what it's 40 in chinese it's 100 4101 we've got all these special words and you know what
I can I can forgive 40 50 60 kind of you know what I can't forgive what I can't forgive
what were people doing from numbers 11 to 19 11 and 12 like let's let's let's we'll get to 11 and 12
we've got 16 okay just adding team
17, 18, 19.
Okay, you're just adding teen.
14.
However, where's 3 teen and where's 15?
We've got 13 and 15.
It doesn't make any sense.
We added teen and then for two of the numbers of the eight numbers,
they just said we're going to modify it.
And anyway, you might have the reason, but then they got to a...
As my Latin teacher used to say, it makes sense.
You just can't make sense of it.
I disagree.
It doesn't make sense.
Because at some point along the way, it evolved from some language where it did make sense, but then now it doesn't.
So how do you make sense of it?
Well, by the fact that millions of people around the world, hundreds of millions of people use it to count every day.
Well, I mean, that's a bad argument.
Just because it's what we know doesn't make it.
That literally means that it makes sense.
Now, making sense isn't necessarily mathematically the best, right?
But, but, all right, now we're, okay, okay, so let me, let me walk my words back.
Does it make, I mean, well, maybe I'll push back because does it make sense?
Is that not a figure of speech?
Doesn't mean what it literally means.
You know, it's like, I've got a complaint about, but anyways, and 11 and 12 is just like,
we're just out to lunch, you know?
It's like, what, there's 12 months in a year and therefore we got to do something special.
Oh, why, why do you think everything has to be base 10?
Well, it's not about, it's not about it being based.
10. It's about the corner cases that we are. You know, another, another mini tangent within this tangent
is I read George Orwell's 1984, as I believe most kids do in high school, at least in Canada,
if not in America and other countries. And yeah, take a bright cold day in April and read it. Yeah,
yeah. It's my dad, a journalist, avid reader, avid writer, loves Orwell. One of his favorite quotes is,
I'm going to butcher this, but roughly, I'm paraphrasing, is big ideas don't need big words and vice versa.
And he asked me when I finished reading that book what I thought.
And I was like, well, I think they got some really good ideas in there.
And he said, what?
And I said, well, we got all these colorful words like fantastic, great.
Their system seems to make a lot more sense.
You got good, double good, triple good.
Then you got great, double grade, triple great.
And to me, in high school, that made a lot of sense.
Because what is actually the difference between fantastic and marvelous and amazing?
And when you reach for one of those words, are you actually able to describe why?
Anyways, that was young me.
I understand it's better to have a more colorful selection of language because it makes the language more beautiful.
But at the time...
Well, now, this is something where English beats everything else, right?
Yes.
English has synonyms.
Most languages flat out don't have synonyms pretty much.
English, precisely because it is a massively confusing melting pot of languages over the years,
we have synonyms, right?
and close shades of meaning.
Yeah.
I have heard that.
And that is what it makes,
you know,
poetry in English and not that poetry
and other languages isn't beautiful as well,
but you can have evocative,
whatever,
sentences that,
you know,
choice words that hit people differently
that you don't necessarily get
in other languages.
I can appreciate that now that I'm older.
But young me was like,
you know,
you know,
and probably you can now also live with
contradictions,
right?
It doesn't, like, human language doesn't have to be perfect or even very precise or, you know,
it doesn't have to have a system that can be explained in a few sentences.
It's true that some, you know, particularly around orthography and things like that, you know,
like a language like German, if you can, if you can spell it, you can say it pretty much
all the time, right?
when you read German, you just need to know how those letters in that form are pronounced,
and there are vanishingly few exceptions.
The same is, of course, not true of English.
Yeah, that's one of my other huge complaints.
There's a student when I was at in Hongzhou in China,
and he pointed out his least favorite thing about the English language was the conjugation,
the past tense conjugation of the word to read.
And he's like, I read, I read.
and he's like he's like it's one thing that from you know for my years those are almost like
imperceptibly different it's a whole other thing that you didn't even change any of the letters
in the conjugated word it's just the same word right it's spelt and he's like what kind of cruel joke
are you playing on us like it's at least most you know I am I was you know they change it so
you can tell here it's you pronounce it differently but it's not even not even they couldn't
put one letter and I when I when he pointed that out I was
I was like, oh my goodness, this is a, this is a cruel, terrible.
And anyways, and this made me think of, I was going to say earlier, I also have a disdain
for the uppercase and lowercase letters that exist in English.
When I was in school, I always used to just write an uppercase letters and then make
the beginning of a sentence slightly larger or the character of some word.
Because just why do we have both?
You know, they say, they say it's for legibility, you know, the Js and the Gs.
They go down below the line.
But I just, I don't agree, you know, I don't agree.
I mean, at some level, it's because of everything is because of history, right?
It's because that's the way it's evolved over, you know, the last thousand years or whatever.
Yeah.
But I mean, that's, that, like, makes me think of, like, you know, how we have pedmas and bod mass or whatever you call it.
Right.
And that just, I remember, I did this for the rest of my life, I will remember being in a meeting and a senior person.
because I pointed out that it was just,
obviously that's just ridiculous.
Like, why do we still have this like an APL in small talk,
several other languages?
It's just linear.
It's just linear.
Why do we have this?
It's insane.
We built a hierarchy of precedence attached to a subset of the binary and unary operations out there.
And, you know, technically if you Google,
if you go to the Wikipedia page and you ask for where's the FFTA, where's factorial,
it actually, they do have a Puffet mask somewhere where they put the F in.
And it like, but it only stuff.
Anyways.
And the scene.
your person said, it's what they taught in schools, therefore it's correct. It's what we all know.
And I was just like, are you kidding me? That's not just because like history has got us to this
point doesn't make it like the best. Anyway, so, you know, everywhere we are today is yes defined
by history. I mean, I feel compelled to take the other side. Yes, yes, yes. Please do.
Which is to say that for most people, most of the time, it's just fine. There is no compelling reason
to change.
And while there might be
purer ways to do things,
better ways to do things when
talking to a machine, perhaps,
you know,
going to quote, is it Gerald Sussman?
Code should be written for humans
to read and only incidentally for machines
to execute. I mean, I'm not
convinced by that.
For most people, it's good enough.
I mean, this kind of, one of the other things
in the topic list that I
sent was this kind of,
I mean, I'm not sure who originated it, or maybe it's not something that can be originated by one person.
But I actually tried to look it up, but unfortunately, I asked Gemini, because Gemini has, I assume all the YouTube video transcripts encoded in their models.
And I said, what YouTube video did Dave Abrams give a talk in where he was talking about trying to find, like one of his kind of North Stars in his work and whatnot is trying to find algorithmic truth?
I swear I've heard someone, I thought it was him.
use that exact quote unquote like algorithmic truth. And, you know, he always refers to Stepanov
in his talks. And when I think of people that talk about that idea, I think of Sean Parent,
you, Dave Abraham's and Alex Stepanov. Anyways, somewhere out there, someone said it. And they
pointed me at a, or Gemini pointed me at a C++ now 2020 talk, I think, or four talk, where it was
part one of two of value-oriented programming or something like that. And he does mention
truth and generic programming, but it wasn't the exact talk. And I'm pretty sure it's because it was
one of his algorithm talks that he's given at WWDC,
but those have kind of disappeared off the internet
and they don't live on YouTube.
And I bring this up because when you say it's good enough for most people,
I guess that's kind of...
I am not saying...
I'm not saying that it is good enough for all use cases, right?
What I'm saying is conventions matter, I guess.
I'm not saying it's not a noble pursuit to try and, you know,
and be aware that I'm purposefully taking
this side of the argument. There's not necessarily
represent what I do every day, but
it is part of it. Like, I do feel this. It is
and it's fine to look for new and better ways of doing things, but
also at the end of the day, we have to be able to communicate with people.
Some fields require extra precision. It's true.
But my argument is like the convention of Bodmas
or please excuse my dear aunt Sally, things like that.
I've never heard of that.
I think that's the American thing people get taught.
But that's also, you know, there's more than what people get taught.
That is a convention that mathematicians use to read things.
Like, obviously, they don't have to think about it consciously all the time.
But in writing out equations, that there are conventions.
And if it's not hemmed as, it's something else, right?
I mean, this is a very, I mean, we're kind of off on a tangent.
But this is a very, yeah, this is a very interesting, so, you know, to strap in,
listener because this I find this topic this conversation this is exactly what you and I would be
talking about if we were at some conference after a long day of talks yeah yeah we would be having
this conversation because it makes me think of two things so you know you said convention matters
I don't I don't disagree that being said you know a part of Iverson's goal creating
APL which became a language but at first was just a notation it was a thing that he used for teaching
algorithms and on chalkboards.
And he was, he looked at the state of notation across subdomains and mathematics linear algebra,
calculus, et cetera.
And was just like, what are we doing here?
What are we doing here?
You know, this is not, you cannot tell me that this is the epitome of mathematical communication,
you know, and I've whined about many of these things, the fact that we give symbols to
certain binary operations.
But then we, we just stop.
We stop short.
Where's the symbol for men?
Where's the symbol for max?
You know, we've got a notation for a reduction for summation with the capital sigma.
We've got one for product with capital pi.
And we just stopped there.
We just stopped there.
Those are the only two important enough.
Don't get me wrong.
Those are probably the two most common reductions, maybe the most too common.
So if you're only going to choose two, you probably choose those two.
But I actually would actually push back on that, though, because how often are you doing a product?
You probably do a min and a max reduction more than you do a multiplication reduction.
Food for thought.
Proof of thought. Maybe not in finance because you're doing like 1.01, but if you're actually doing integers, you overflow very quickly. Anyways, the point being, he took a look at the state of the art and was like, we can do better. And that's what he tried to do. It never caught on. And then when that thought process went through my head, what you're talking about here also kind of like attaches to why Python and JavaScript, which many people, not necessarily no one, would argue that those are not the perfect or best. Even if there is such a thing, if you're going to rank them, is it like, you know,
the language you would reach for.
You know, a lot of people say that Python is the second best language for everything,
but not the best language for everything,
yet it's still very popular.
Right.
And I have come over time to have more sympathy for that,
like, actually maybe Python really has done something, like, really well.
Even if it's not great for the programming language enthusiasts
and programming language implementers,
there's a reason people reach for it.
And...
Yeah.
What Python does well is it meets people where they are, right?
Python is a language you can write without knowing Python.
All you need to know is what you want to do to instruct the computer
and the barest of syntax.
And you basically write your pseudo code
and it turns out that Python's fine with that.
So you don't have to learn a lot.
Yes.
And then of course later on,
you can learn things which are more pythonic or better or somewhere.
But fundamentally, it meets people where they are.
Yeah, it's the steepness of the,
on ramp or the learning curve to your first line of Python and your first small working program
is very, very...
So shallow.
Yeah.
If imperceptible, you know, like compared to something like APL or C++ plus or Java back in the day
when you did.
We have to figure out to set up a tool chain or, you know, figure out what the glyphs mean.
Yes.
And so I think that there is, there's a lot of, I don't know, truth or wisdom to be found.
and like, why is Python and why is JavaScript?
Why are they so popular, even though people have so many complaints about them?
And so I, in one sense, I agree that, you know, this being able to communicate,
there are other things other than like the perfect language or, you know, whatever,
whatever my North Star, you know, algorithmic truth.
There's more, there's other things.
It's not that that's not important.
That being said, I don't know, I guess, you know, part of this like recreational algorithms,
this topic overall and the playfulness and truth is like I don't know there's the language that I
think in and the vocabulary that I use is all like rooted in array languages at all like that is
the best thing I found out there and even a lot of these array languages I have small
issues with be sure to check these show notes either in your podcast app or at ADSP the
podcast.com for links to anything we mentioned in today's episode as well as a link to a get-up
discussion where you can leave thoughts comments and questions thanks for listening we
You hope you enjoyed and have a great day.
I am the anti-brace.
