Algorithms + Data Structures = Programs - Episode 217: Pragmatic vs Inspiring Talks, A Bug and More
Episode Date: January 17, 2025In this episode, Conor and Ben chat about different styles of talks, diagnose a bug and more!Link to Episode 217 on WebsiteDiscuss this episode, leave a comment, or ask a question (on GitHub)SocialsAD...SP: The Podcast: TwitterConor Hoekstra: Twitter | BlueSky | MastodonBen Deane: Twitter | BlueSkyShow NotesDate Generated: 2024-12-16Date Released: 2025-01-1713 : Foreign Function in JPointfree.ioC++Now 2017: Ben Deane & Jason Turner "constexpr ALL the things!"Ben Deane's blog post "Six languages worth knowing"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)
When I stand up and give a talk, I don't want people to see that talk and think,
you know, wow, that was cool, but I could not approach that.
What I want people to take away is like, that was cool. I'm going to go try that in my code base. Welcome to ADSP the podcast episode 217 recorded on December 16th 2024. My name is Connor today
with my co host Ben we chat about different styles of talks, we diagnose a bug and more. more a question that occurred to me earlier is there a way uh you mentioned that a lot of things
a lot of times in your videos you show building up a function and then converting it to tacit form
i assume there's an automatic way to convert it to tacit form that's because that exists in other
functional languages i'm pretty sure yes i don't know if it exists for BQN.
I definitely know that not only does it exist for J, but there is it actually built in what they call a foreign function in J that goes from explicit to tacit.
I know Haskell has pointfree.io that goes from explicit to tacit as well.
I would imagine there's a bqn one out there
i don't actually know because by the time i started learning bqn i was already enough of
like a tacit uh expert to like i don't need ever to go to those tools in fact like right
that's one of my biggest worries and is that you know i've the evolution of whatever my
algorithmic combinatory path is that like i love the combinator stuff so much is that like i've the evolution of whatever my algorithmic combinatory path is that like i love the combinator
stuff so much is that like i've i've become that teacher that has lost all sense of like how
complicated a thing is because they swim in the topic and it's been so long since they they
struggled with forks and the basic stuff that like uh i'm harming i'm harming the reputation of array languages by showing this
cool trickery stuff that is not practical and i like i i've heard folks that say you know we
actually need to focus more on the practical array languages like use of array language is not the
highfalutin right um combinatory stuff well you can still show the shining beacon on the hill, right?
You can still show that, you know, and this that talk and think you know wow that was cool but
i could not approach that yeah uh what i want people to take away is like that was cool i'm
gonna go try that in my code base yes you want you want there to be takeaways for folks and uh
which is why i some of your talks are just you know they're
in my all top i mean i always mention the uh i have sometimes like i don't always hit that mark
sometimes i give talks and they are kind of out there sometimes and sometimes that's a good thing
it depends on the crowd right like when jason and I did Constexpr all the things at C++ now,
that was
a great example of a talk which was like
here's exploring
what's possible.
No one in their right mind would
write what we did
that way or really use it in
production. But for that crowd,
it was like
lighting a fire under the standardizing constexpr yeah
and i i was i was gonna say before like i always mention the easy to use hard to misuse but then
right when you said oh some of my talks are out there it's is it funny that i mentioned that talk
all the time it's the talk that hit the hardest for me where i was on my learning path which is why right i i think it's
it's okay to give talks at different levels because depending on where everyone is on their
learning journey journey like they're gonna watch that talk and be like ah this isn't really anything
new under the sun and it's like well okay it's because you learned that stuff already but like
for where i was it was like mind exploding yeah i probably at some point not anytime soon we'll have to
rein it in on uh on the talks that i give these days even the folks that know the material
sometimes um what people say a lot to me these days is like thanks for getting up there and
saying that because i've been arguing this to my boss or my colleagues or whatever. And now I can have some backup.
I pointed something.
Yeah.
Yeah.
Now I'm in research.
So I don't really have to.
I write my own code and not many folks look at it.
They look at what it does.
Right.
So I haven't had to have many of those arguments.
But definitely I've been on teams before where I'll reference, oh, Kotlin something or Haskell something.
And they'll be like, what are you talking about?
And I'm like, I'm saying I'm not making this stuff up.
Like other languages, this is like a pattern.
And then it's like, Ben gives a talk and it's like, okay, now Ben,
now there's someone in the C++ world other than me that's saying the same stuff.
Right, right.
And it's funny because people in the, you know, people in the functional world who,
some of the stuff I presented in C c++ they've been doing it for years
and they look at the talk and they're like oh yeah yeah that's nothing special oh finally c++
is getting this yeah you know yeah there's some memes online of whatever lambda comes to insert
language and then everyone's going around it's like you know half a century ago lisp, you know, half a century ago. Lisp, you know, already had it.
But hey, it's better late than never, folks.
Better late than never.
Talking of, let's wrap up.
I mentioned to you earlier that you had a bug in one of your solutions to Advent of Code.
Talking about going full circle.
I believe day seven. Now, when you solved day seven, actually, you showed building up part one.
But then the code you showed, you had a reworking for part two.
And then you solved both part one and part two with the reworking, which happened to be correct.
But I think in your part one work, you had a bug.
And the bug was in the evaluation.
So day seven was the thing that put the plus and the multiply combinations
in between the expression, right?
I was watching that video, and there was a point where you went from
showing the lists, showing the strings to evaluate,
and then you changed to showing the evaluation
there's a point in the video where it flips over and that had me scratching my head because i'm
like that string does not evaluate to that number i think and i think there was a bug therefore
like i think bqn is doing does it do right to left evaluation oh yes i think that and i think that's the bug because you have to do left to right evaluation
in that problem without operator precedence it's very strict and that is not the same
you get different answers doing right to left interesting uh well let's here i'll quickly
just so that we can both get the reveal, share my screen for a couple more seconds.
So, I can just do this.
Right, okay.
I have both solutions still in my code.
Value is the one that builds up a string.
And value two is the one that has a list of actual operations.
Mm-hmm.
And value two, if I'm looking at this, what is it doing with okay this is a block so
uh we need to get rid of our list of operations that value two takes as a left argument
and so now we're just calling value on our list of numbers and I'm curious to see what happens if we go to bqn code aoc
and let me hide this so I can see what I'm typing and we go bqn test.
Oh, except it's taking time because I've got part b uncommented.
This shouldn't take this long to run or maybe it actually does take.
So, actually, let's get rid of this.
Okay.
So, this supposedly, at least for the mini input it might pass by accident because because
for the mini input the ones that work might just be simple additions or something else
um there's only two that work in in the sample first and last and I'm not sure there might be ways to evaluate those. So the first one is
trivial, like 10 times 19 is 190.
There's only two terms. So I actually do recall
it saying that it comments on the evaluation
left to right. And not according
to precedence. So the question is did i i think
this is where the bug is not so i have with the single glyph reversed my numbers and made the tail
backwards there was still a part in your video where you go from and the video shows
this is going to be annoying i can i can bring it up and scroll it online um we're doing a deep dive
so i mean there's a point in your video where you show here's the um here's the strings to be
evaluated and the next beat is you showing the evaluations of them
uh i think it's maybe another minute or so oh yeah so i am live coding it and
technically i think you're correct then so in my video there might be a bug because
i'm actually skipping the parsing code and i've just copy and pasted a single example
and then definitely what you so that is you were paying super close attention uh i'm surprised
well i'm not surprised no one else caught that because that's such a narrow thing to catch but
yes on the the video version i'm just doing it in bqm pad which is just a web editor and i i just assign to a single
local variable called line uh input and skip all the parsing and therefore the solution that i've
coded up misses the fact that you've actually need to reverse the tail portion of your line
and ben clearly was uh paying attention to that and noticed that yeah so just after this but
yeah you form the matrices and then you uh rotate uh transpose unravel them and then yeah so here
we've got the expressions list now if we look at for example the third one six plus eight times six
plus 15 evaluated strictly left to right it's's going to be 6 plus 8, 14, times 6, 84, plus 15, 99.
Is that right?
Or 84.
6, 14s are 84, right?
Yeah, 7, 12s.
Plus 15, 99.
So the third number should be 99 when evaluated.
But in fact, it comes out to 174 and 174 is 15 plus 6 21
times 8 168 plus 674 yeah and what's funny even while you were working through that math i was
evaluating it right and i was like what is he doing six plus eight four and i lost you for a
sec because i was like it's 21 and i was like was like, oh, right. The point being is that I'm evaluating a BQN expression, not a math expression.
Well, it's not even math.
It's left to right.
It's technically small talk because if we're using ped mass, you do the eight times six first.
Yeah.
Yeah.
But it's left to right versus right to left.
Yeah.
So, you are correct.
There is a bug not in my…
There's a bug in the video.
Yeah.
Clearly, you got the right answer because you you must have
got the right answer to part one or you wouldn't have been doing yeah yeah exactly yeah and it
skips to vs code like 30 seconds later where the parsing happens and silently there is a a both a
rotate and a reverse glyph because they are the same thing but in this case it's the it's the
reverse glyph have you and how many so you said you've solved a couple problems i've solved like
one two three seven and eleven that's all i've done this year okay i'm kind of resting on my
laurels the first i've i've solved one complete year back when it was and i'm even on the leader
board like 98 i I think, finally.
In 2015, when almost no one was doing it and it was brand new,
I did all the puzzles that year because I happened to have free time. Although at about day 15, so in the early, my leaderboard stacking,
not that I really go in for competitive coding or fast coding,
but I was using the
technique of you know do the puzzle by whichever is the best way to do it i think one of them was
literally just it was like find the matching paren and it was like okay well i'll just open
up this file do forward s expression do and find where the point is that's the answer so it was like do that in your editor
um but yeah i think after on on one of the teen days 14 15 16 i i went from california to england
and so suddenly i was going from puzzles at nine o'clock in the evening to puzzles at 5 a.m um which was the
reason why my my my leaderboard really tailed off after that yeah that's a bit rough i yeah i'm
jealous of the folks on the pacific coast it's a a much nicer time maybe not in the first couple
days i think i'd solved them in less than 10 minutes. And actually, the servers were down.
Oh, wow.
On the opening night, I couldn't get access to the problem for, I think, three minutes.
And it was, I can't remember what the error that I got was.
But the last couple nights have been totally fine.
But yeah, I think I solved it at the 10-minute mark.
But it had been like three or four minutes before I got to the problem.
But yeah, at 9 p.m., once the problems take like an hour ish to do doing that until 1 a.m in the morning yeah if you're doing that in
the small hours that's tough at some point probably you're like you know i just need to go to bed
because it's not working out if i like continuing is not actually getting me any closer to solving
it yeah and it's interesting i've never actually done a full year
i'm not sure if i'll do all 25 but i'm at 28 stars 14 days so far and i'm almost all of these are
just like grid-based path searching there hasn't been a ton of like algorithmic um which to be
honest i'm not complaining because bqn it's brilliant like as soon as you have x y coordinates you can do like point addition by
just you add you know oh i need to do a hundred moves and it's like well i i can just literally
generate an iota sequence and then add my points to that and it works fine but uh i thought i
thought in years past it gets more tricky but maybe it's now that I just have parsing functions. And as soon as you can parse things.
Yeah.
Once you have the function to parse the input.
Yeah.
It gets rid of honestly,
like 40% of the work sometimes.
Yeah.
I think last year,
one of my colleagues,
I think it was Michael who said like he was doing it.
And then around about day 10,
he got sidetracked by building like a pause,
a combination library to deal with AOC.
Completely reasonable.
Anyways, we will leave links for everything we mentioned in the show notes.
I would encourage folks, even if you only solve a single day, it doesn't need to be BQN.
Choose a language that's on Ben's list.
He had a tweet about it and a blog post about it in a different paradigm.
You know, whether that's...
Oh, I think that tweet is now deleted.
Oh, I mean, we said last comment or last topic or last thing a couple different times.
You mentioned Blue Sky.
Are you on Blue Sky now?
In as much as I'm on any social network, I am on Blue Sky.
I have zero posts, but I exist.
I see.
Cause now this is like three months after I joined Mastodon.
It's like, and this is why I held off for so long.
It's cause there's continues to be this proliferation.
And, uh, I just, I don't need more.
I just, I just need one.
I don't want, I don't want any.
And, uh. All right.
But you're on Blue Sky.
And are you off of Twitter now?
Because you said it might be deleted or is it everything's gone?
My Twitter account exists, so no one can impersonate me.
But there's nothing there.
And to be fair, I hadn't tweeted anything since 2020.
You know, the pandemic was a good time to quit social media.
Yeah.
I'm trying to think.
Well, so, some of your tweets live on in my talks because I've screenshotted them.
But the ones that I've retweeted, that means they're gone now.
But your favorite one, the one about, I mean, it still exists in idea land, right?
Yeah. Well, you still have the blog post. The idea is learn. Yeah, it's exists in idea land, right? Yeah.
Well, you still have the blog post.
The idea is learn.
Yeah, I still have the blog post.
Although the blog, you know, I blog recently, actually.
I blog about once or twice a year these days.
Yeah.
And the idea is learn languages that will increase the paradigms, increase your toolkit.
So, you know, C++ java and rust and python they're all
at some level the same language um as distinct from apl bqn that's entirely different family you
know uh haskell lisp different family small talk prologue prologue yeah there's uh a bunch of different ones and
you'll know you'll know when you stumble into a new one because yeah because everything will be
really difficult and you're wondering how to do things and how on earth do these people get
anything done in this language it's not like how i expect but also it can be freeing you know
whenever i'm in a language where i feel like i'm an expert in i am always oh you know i can never just do something you know the wrong way just to get
things done because people are watching but then you come to a new paradigm it's like well i don't
know what i'm doing people can't judge me you know i i yeah right at the top of my t-shirt says i
don't know what i'm doing here so uh every anything goes and uh yeah absolutely and with fm code like we said any route to a solution
counts there's no there's no cheating there's no gatekeeping here if you can solve it in whatever
language great if you can't solve it look up a solution and learn from it yeah still works
they only ask for the answer not for the code code. Alrighty. Well, I guess we'll say happy holidays to both you and the listeners.
Yeah, thanks.
Well, at this point, I'm not sure at what point the happy holidays portion will actually come out.
So, maybe I'll have to cut this into a sooner episode.
We've recorded at least three three if not four episodes here and uh so we'll
be saying happy holidays in second week of january this was supposed to this was supposed to be an
hour and it's gone almost twice as long as that because i budgeted more than an hour i have to say
because you know we get together we only talk to each other once a month or so
and we always have interesting things to talk about yeah yeah especially if you're going to ask
questions that are algorithmic plus apl plus bqn central then yeah i'm gonna i'm gonna we're gonna
lose track of time you add haskell in there c++ Anyways, I might try to insert this little happy holidays.
Yeah, happy holidays.
And if not, then maybe it's happy new year to the listener as well.
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 GitHub discussion
where you can leave thoughts, comments and questions.
Thanks for listening.
We hope you enjoyed and have a great day.
I am the anti-brace.