Algorithms + Data Structures = Programs - Episode 60: BQN's After (⟜) and the Parentheses Poll

Episode Date: January 14, 2022

In this episode, Bryce and Conor talk about BQN’s after (⟜) and construct a twitter poll about parentheses.Date Recorded: 2022-01-08Date Released: 2022-01-14ADSP Episode 55: LeetCode in C++ (Part ...1)ADSP Episode 56: LeetCode in BQN (Part 2)BQN SolutionBQN Programming LanguageArrayCast Episode 17: Tacit #4 - the dyadic hookSuper Computing (SC) ConferenceBoostCon 2011 - Bryce Lelbach: AST Construction with the Universal TreeBoostCon 2011 - Bryce Lelbach: AST Construction with the Universal Tree ~ SlidesADSP Twitter Poll on ParenthesesGTC 2022 Will Be OnlineCppNorth Call For PapersIntro 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)
Starting point is 00:00:00 and we hit shift enter boom uh and the reason why it's showing four is the answer is because it's doing the last unit test so if we do that again we get boom uh that doesn't look right Welcome to ADSP, the podcast episode 60 recorded on January 8th, 2022. My name is Connor, and today with my co-host Bryce, we talk about BQNs after and construct a Twitter poll to settle the debate, are parentheses necessary? Wait, where are you? Is that a Zoom background? background no we're in google meet or is it a is it you're not actually you're not actually in this like cafe that appears behind you right nope i can't believe you can't even tell man i i could tell hey there's. There's snow. I want to have a snowball fight. And I figured there must be some way, like in New York City, there must be some organization for like adults that want to have snowball fights.
Starting point is 00:01:17 But I mean, obviously probably not practical with COVID. No, maybe it is practical with COVID because like it's an outdoor activity. Anyways, if there's anybody in New York City who wants to have a snowball fight with me, please let me know. I'd love to have a snowball fight. No, like no ice in the snow though. Like that's none of that nonsense. You're a full grown adult asking to have a snowball fight with your adult friends. That is correct. I, not even with my adult, like not even with your adult friends. That is correct. Not even with my adult, like not even with like specific friends. I'm just like, I'm a grown adult announcing on my podcast to the internet that I'd like to have a snowball fight. This actually reminds me of a story. So this episode is going to be our 2021 retro talking about the highlights and a couple
Starting point is 00:02:02 other things. Before we get to that though, I will tell the story of when I lived in China in 2012, which we talked about all the way back. You know how many years ago 2012 was? Yeah, we're old men now. But during Christmas time, or maybe it was January of 2013, it snowed in Hangzhou, the city I was living in, and the locals went like crazy. I was at this lake called West Lake, Shihu,
Starting point is 00:02:33 and I guess it doesn't snow there very often, and it snowed like a few inches so that you could have a snowball fight, and there ended up being... I was young at the time, and so I ended up sort of like very playfully throwing a couple snowballs at like these kids that were playing in this little grassy area that, you know, had a bunch of snow. And then five minutes later, I, it was like this 20, 30 person, you know, snowball fight. Half of them were kids and like half of them were like grown adults.
Starting point is 00:03:04 Some, some of them were bringing and like half of them were like, uh, grown adults. Some, some of them were bringing their umbrellas. Um, why you have an umbrella while it's snowing is not entirely clear, but many folks had umbrellas and it was, uh, is, uh, it was one of the most wonderful memories of my life. I was there with a friend, Antonio, who still lives in China. And, um, yeah yeah the snowball fight of christmas 2012 it was just like the coolest craziest and yeah anyways snowball fights are fun that sounds that sounds lovely that sounds lovely so so so what's with the what's with the google meet background are you just like embarrassed by your you know closet that i've been teasing you about? Nope, nope.
Starting point is 00:03:47 I'm not even, I'm technically not even in the closet today because I need to screen share. And I just discovered this the other day. I was having a meeting and the person I was with had a little background. I was like, I didn't know Google Meets did that. And it's the best. So I got this little, you even thought I was in a cafe. Connor, if you have the background, I can't judge your interior decorating.
Starting point is 00:04:10 All right, fair enough. You like the flowers in the background of mine? Yeah, I took out the vase, I put some flowers in, yeah. It's feeling floral today. No, no, no, no, no, no, no. It's okay. You can have your Google Meet background.
Starting point is 00:04:24 I don't want to ruin your fun. I'll still find ways to make fun of your interior decorating. Literally, I turn it off and it's just white walls in the background. White walls and a white chair. White walls, white chair, yeah. All right. Before we get – well, actually, how's it going, man? We haven't chatted in a few weeks.
Starting point is 00:04:44 Happy New Year. Happy New Year. actually, how's it going, man? We haven't chatted in a few weeks. Happy New Year. Happy New Year. Yeah. How's your New Year going? So far, so good. January 8th. We're a week in, 100K down, and it's going pretty good so far. How's your New Year going?
Starting point is 00:04:58 It's pretty good. Pretty good. Yeah. All right. So let's do this retrospective wait wait wait so I've got a list of things I actually have notes it's like the first time because we haven't spoken in so
Starting point is 00:05:11 long that there's all these little things that I wanted to bring up the first thing most importantly and this is sort of if we've got any new listeners today you're going to be prepared to be confused because we're going to be referencing an old episode and not giving a ton of context. Let me do a screen share, a window, and we shall choose this one.
Starting point is 00:05:30 Do you remember the BQN solution? And I promise, listeners, we did get a couple complaints on the Twitter about how all the episodes have been awesome. They love the content, but like maybe don't live code, especially in a language that is just Unicode symbols. I think in the future, we're going to save the live coding for like YouTube episodes, which, which are coming listener.
Starting point is 00:05:57 They are coming. Sure. After the Balkan tour, 2023. Um, yes. But, uh,
Starting point is 00:06:04 so we, we, we've, we've heard you loud and clear. It was, I think, one individual. I don't remember the name, but someone did. I think that one individual probably spoke for many others. Yes. And I think even we even self-reflected in the part two of that live coding being like, this is probably not. Nobody's going to be able to follow this up.
Starting point is 00:06:21 Yeah, this is probably not the best content. But the important thing, Connor, is that we had fun. Because at the end of the day, the key thing here is for us to have fun. And if other people happen to have fun, that's fine too. Is that the most important thing? I'm not sure. But yes, having fun is important. Anyways, I will link to the part one and part two of our live coding where we had a very simple problem
Starting point is 00:06:45 that was called target indices. You're given a list of numbers such as one, two, five, two, three, and then you're also given a target value, which in the first example is two. And the problem asks you basically to return a list of indices that correspond to where the target value would show up in the sorted list. So 1, 2, 5, 2, 3. Sorted would be 1, 2, 2, 3, 5. And because we're doing zero indexing, the target value 2 shows up in index 1 and index 2. We're not going to rehash the whole problem solving. We did it once in C++.
Starting point is 00:07:22 We did it once in BQN. And the only thing I want to highlight is in our final solution, we had this beautiful combinator overloaded galore. And even Bryce said the sad thing is, is that he could actually understand this, where you had sort of two binary transforms, and then you were doing a reduction on both of them and then once you had basically the count of your target values and the number of values that was less than that you could create your list of indices and at one point we had this five character expression left plus range composed with right and then what that was basically doing is it was applying iota to the number of values, target values that show up.
Starting point is 00:08:10 So in our case with two, you're going to go basically range two or iota two to get one two. And then you're adding the number of values that are less than it. And I made some, so you don't really need to fully understand what I said, but we have this five-character expression thing. And if you go back to the episode and listen to it, I said, you know, in J, I think actually there's a thing called the dyadic hook, and this is exactly what it's doing. Well, guess what? On episode 17 of Arraycast, my other podcast, I brought this problem up, or not exactly this problem, but it came to in the middle of the podcast that I discovered you can actually do this in BQN. It is a glyph called, if I get this right, before. Actually, it's called after. And if we zoom out a tiny bit and we hit shift enter, boom.
Starting point is 00:09:03 And the reason why it's showing four is the answer is because it's doing the last unit test. So if we do that again, we get boom. That doesn't look right. Is it after? Is it before? Oh, right, right, right, right, right. Is it right? What's going on here?
Starting point is 00:09:21 Watching Connor fail in real time is something else. Nope. Nope. All right. You are going to have to liberally edit this. We're going to go to the place where I have the pre-coded solution. We're coming back to BQN. What am I doing wrong here?
Starting point is 00:09:41 Oh, right, right, right, right. Yes, yes. Because the way it is is that we're doing. So that's actually what I had before. Why isn't this working? Why isn't this working? It is after. It is after.
Starting point is 00:09:58 Oh, God damn. There's one more. There's one more test that I didn't come. I am going to have to make some editorial decisions here. You are going to have to liberally edit this section. I might just leave it all in. Who knows? Because it's somewhat funny.
Starting point is 00:10:16 But I had it right before. So it's the after glyph. And literally what this does. But I want to note. I want to note. I think we got feedback on the internet that the internet agrees with me that having the parentheses is better than not having the parentheses. That they help clarify what's going on instead of relying implicitly on order of evaluation rules that only like Connor and the two other BQN programmers in the world know. So, actually, I said I would take that poll, and you're saying that the Twitter agreed? I never actually put that poll up there.
Starting point is 00:10:55 I'm not saying I have quantitative data, but I do have qualitative data based on we got some tweets when we posted the episode. We got some tweets that said posted the episode. We got some tweets. We got some tweets that said, where's the poll? They didn't actually say lean left or right. Fine, fine, fine. Then let's make the poll. Let's make the poll right now. You want to make – okay.
Starting point is 00:11:20 We'll make the poll. We'll make the poll right now. So wait. We'll use this final solution. Yep. And you know what's also valid? Huh? We get rid of these parentheses right here.
Starting point is 00:11:33 And the problem is – actually, no. The problem is I kind of agree that the parentheses help here. No. You do not get to get out of this. Well, no, no, no. Let's pick another one. But let's do the one where it was. Let's just go find the problem because it was in.
Starting point is 00:11:53 We can just go to our show notes. Amazing. When were we talking? Oh, my God. You actually put links to my talk in the show notes. Oh, yeah. And I also went and found your slide deck because that. Oh, yeah. So this was. You found the slide deck from my first conference talk ever. This is actually so this is episode 55, the part one of our live coding.
Starting point is 00:12:17 And you actually said that your first talk was supercomputing. And then I asked was at supercomputing. And then I asked. It couldn't have been. It couldn't have been supercomputing. My first talk was supercomputing and then I asked, was at supercomputing and then I asked, oh, it couldn't have been supercomputing. My first talk, I think if I said that, I misspoke. My first talk was that way. My first talk was not supercomputing. I said it wasn't BoostCon. It was a Linux Foundation collaboration summit a week before BoostCon.
Starting point is 00:12:36 Oh, okay, okay. Yeah, yeah, yeah. I remember while editing, I realized that I was saying that, oh, I'll get your, I'll find the link to your first talk, but there was no recording of it. But I did go and find the first recorded talk that Bryce ever gave, which was at BoostCon 2011. So even before the snowball fight of Hangzhou 2012. And it's really poor slide deck quality. Like the recording is here. let's just take a let's take a brief oh no please oh please you can barely make out and is this the highest yeah but it's
Starting point is 00:13:14 the highest is 480p which we're on that's that's how we recorded it back then and uh cute little bryce um 10 years ago bryce the slides were actually like not terrible slides though. So yeah, like it. I did stay up until like 4 a.m. Like I was up at 4 a.m. the night before like preparing the talk and rehearsing the talk. I got like no sleep. Yeah, but so I actually, I haven't fully watched it. But what I did want is I wanted the user to actually enjoy the full talk experience.
Starting point is 00:13:45 So I went and dug up the actual slide deck PDF, and so I linked both. I linked both the talk and then the slides, which I think is the PDF. Let's look. How many slides were in that deck? Let's take a guess. Over, under. I only used like half of my time. And I think maybe I had between 20 and 30 slides.
Starting point is 00:14:09 Really? Oh, I like my first boost or C++ Now talk had like 180. Yes, but Connor, you gave your first talk at like a different point in your career. I was like a little 19-year-old shit. Oh, wow. There's more. Okay. There's like 57.
Starting point is 00:14:25 51. Okay. There's like 57, 51, 52, Bryce Lelbeck, github.com slash Bryce Lelbeck slash Prana. Let's take a look. No, no, no.
Starting point is 00:14:32 We're not looking at like stuff that I, stuff that I started building like many, many, many, many moons ago. Nope. 23 stars. Pretty good,
Starting point is 00:14:42 ma'am. All right. Oh, actually. Yeah. We had good, ma'am. All right. Oh, actually. Yeah, we had a thing. We were creating a Twitter poll. Yeah, yeah. So, well, what happened is we went to the show notes to find the original BQN. And the original is actually the first solution as I switched back to this BQN tab.
Starting point is 00:15:02 It's the first solution. And I believe, so let's delete these. So the point is, BQN is awesome. And there is a Unicode symbol called after that is the dyadic hook. And also before is also like a flipped dyadic hook. So I'll leave a link. Go listen to that ArrayC. If you care. Now we're going to create this Twitter poll. Clearly this is going to, as this never happens before, this is going to be two episodes.
Starting point is 00:15:30 You'll hear, uh, you'll hear the 2021 retro in episode. Uh, what are we on now? 50, this is 60. So you'll hear the 2021 retro in episode 61.
Starting point is 00:15:41 Um, currently we're building this. So the three train, I believe is here and then the B1 combinator is here. So this is going to give one to, and so there's, what, what, what parenthesized version would you like? My version will be the five Unicode symbols. You want this version? Yeah. Okay. So this is. Let's take it to the Twitter. This is Bryce's. What do we want to call it?
Starting point is 00:16:10 We'll call it Bryce's. And then I'll delete all the parentheses. And we'll call this Connor's. And first we're going to go. Who do you think is going to win? I honestly. I think that it's I mean, the question is
Starting point is 00:16:31 what are people going to vote based on? Are they going to vote based on the comment with a name next to it? Is it who's your favorite host? Or is it actually going to be based on the content of the poll? Wait, if it's who's your favorite host, who's going to win? Oh, I think that's me for sure.
Starting point is 00:16:48 I think that's me for sure. Oh, you're so very wrong about that. So very wrong about that. I have a very loyal following. Oh, man. We should do multiple polls here. We'll do a BQ. Here we go. That's very nice.
Starting point is 00:17:08 Alright, so now we're going to do a little screen capture. Oh, actually, we'll just copy the text into the poll as well. Alright, now we're going to Twitter. Am I actually logged in
Starting point is 00:17:23 to... Yeah, you're logged in. Do I actually logged in to... Yeah, you're logged in. But do I have access to ADSP from here? I don't. I think I have to go to Firefox. Why? Because I have like seven Twitter accounts and you can only log in to five at any one time
Starting point is 00:17:44 on a single. So get rid of some Twitter accounts. You don't get seven Twitter accounts. I'm sure JF also has this problem. I'm going to reshare just because I don't want Bryce to be left out on this experience of, or yeah, I guess I can just share my entire screen. I don't know. Then I might see stuff.
Starting point is 00:18:04 That's true it's a risk hang on I'm looking for I'm looking for anything juicy there's nothing juicy alright so here is the photo
Starting point is 00:18:13 oh snap you can't post photos alongside a poll alongside a poll absolute garbage well we will post that photo in a sec
Starting point is 00:18:23 you can retweet the poll with the photo, I think. I'll just comment on it. And now we need to go back to... I guess I should get ready to retweet this with my substantially higher Twitter follower count. Yeah, yeah, yeah. That's true. That's true.
Starting point is 00:18:38 You do have more Twitter followers. Yeah. 10.5K. That's what I'm talking about. And let's check on how many JF has because I know he's been catching up. Yeah, I saw him troll you. Oh, no, no. Actually, JF is like a good 400 Twitter followers behind me.
Starting point is 00:18:59 Like he, that is the largest gap that we've had in a while. Woo! That's nice. That's nice. That's nice. Yeah, JF, you're just falling behind. Just falling behind. See, I think the problem is it's the new JF Twitter profile picture, which makes him look like he's got a very substantial beard,
Starting point is 00:19:21 and it sort of makes him makes him look like jack dorsey it's not as good as his previous profile picture in my humble opinion sorry jf if you're listening to this should we leave the target indices part out? Yeah, that's what I was thinking, to emphasize more. Yeah, I think so. And I say that mostly because it is an amusing fact of languages like BQN and APL that literally the name of the function that we're defining is more characters than the function itself.
Starting point is 00:20:04 And that is the beauty. The name of the function might be twice as many characters as the function definition itself. That's the beautiful thing. Like whenever you're competing in leet code, they always give their function names to the problem, like something very similar to the name of the problem, which can be, you know, four or five words. So half the time, it's like a six-character solution. And then to spell out
Starting point is 00:20:29 the name of the function, it's like 20 characters, which is the best. So what is the preferred BQN solution to target indices, parentheses from episode 56? See comment in the photo below. We'll do this for what? We'll do it for the weekend. So three days? Sure, sure. Or actually wait. Oh yeah, this is going to go out. And also too, yes, so I actually haven't put our names. No, no, no, we're not putting our names.
Starting point is 00:20:53 We're not putting our names. Yes, of course. We will at a later date, maybe when the 2021 retro goes out, although this is going to be in episode 50, so maybe next Friday when the episode drops, we'll do a Who's Your Favorite Host? And then that's going to be in episode 50 so maybe next uh friday when the episode drops we'll do a who's your favorite host and then that's going to be pretty contentious although should we allow retweets because i feel like just we'll figure it out folks we'll figure it out
Starting point is 00:21:15 we're gonna we're gonna do retweets we're gonna do retweets because we need the reach all right all right i feel like half of your followers might vote against you anyways um just i mean look look look knowing knowing my um my brash and over-the-top personality it is it is quite common for even even my devoted followers to troll me incessantly as evidenced i don't know if you saw jf's little prank that he pulled on me. I did. I did. Very nice. Well done, JF. I know you all have a rival podcast. What JF did was JF sent me a link that appeared to be a link to a Wikipedia article about me,
Starting point is 00:21:55 but was actually a subtly constructed link to something else. And, yeah, he got me. He got me. got me i'm not gonna lie he got me okie dokes um 50 50 right now folks you're listening to this probably on january yesterday by the time you're listening to this episode it's too late like it's over yeah the the results of this poll have come in, and I have clearly been victorious. Connor has lost and has agreed to put parentheses in reasonable places in his BQN code. Oh, I'm not going to – what did I say last time is that the listener is misinformed if they get this poll wrong. But I honestly – I've got hopes for myself here. I think that your hopes are mis-
Starting point is 00:22:45 Whoa, wait, wait, wait. You have to delete the poll. Why? I'm going to let you read the poll again and figure out why you need to delete the poll. I don't know. Look at the two options and tell me whether those are valid code. Oh, fuck. Ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha, ha.
Starting point is 00:23:16 Oh, my God. Do I really? Yes, you do. It's wrong. Connor forgot a parentheses and you were like copy pasting so that shouldn't have even been a possible problem all right we're gonna do this in less than 60 seconds here we go really okay i'm timing you okay time me can connor do it can connor actually do all of the necessary retweeting in should we should we let's let's let it last for seven days then it's you it's your call that you promised to finish
Starting point is 00:23:50 this within 60 seconds and right now you're just using some of that time you are I'm done over the time I'm done I was done three seconds ago you it doesn't matter because I started recording like five seconds in. You took more than 60 seconds. You're done. You're out of here. All right. Let me go delete the old one now.
Starting point is 00:24:13 Yeah. Yeah. Oh, you didn't even delete the old one already? It doesn't count if you haven't deleted the old one. And let's just check. There are the right number of parentheses. Am I allowed to vote? I don't know. I can't vote, no. You have to vote i don't know i can't vote no
Starting point is 00:24:26 from your actual account not that like what is this episode gonna be called bryson connor hughes twitter i was that's garbage so there was four votes before and we were tied and at one point i was ahead by a little bit and now now I'm losing. Yeah, yeah, yeah. There are no recounts in this election. Okay, so seeing as we haven't gotten to the retro yet, let's look at a couple of my other notes, and my notes say that we should announce NVIDIA's GTC conference has gone virtual, thanks to Omicron.
Starting point is 00:25:03 Are we? Is that a thing that's public yet? All right. We won't be announcing that. Actually, let's check. I'm going to check. I'm going to check whether that's public. But in the interest of us.
Starting point is 00:25:18 I know the speakers were informed. I suspect the speakers were informed. FAQ. What is GTC? GTC will be an online event. Woo! Okay, alright, alright. I guess we can say it. I guess we can say it.
Starting point is 00:25:36 So yeah, that's sad. I was really looking forward. That might have been the first time we had seen each other in over two years at that point. Well, we live like a short distance away you should just come visit me uh ontario's back in lockdown all non-essential travel is not encouraged so you had in the spring in the spring you can come crash on this glorious couch and gtc was going to be in the spring anyways the call for papers for cpp north will be opening on uh january 24th which
Starting point is 00:26:08 i believe is a monday um so get your talk proposals ready for a hopefully in-person conference in toronto canada the first ever c++ canadian uh conference um hopefully that it is still planning to go on but you know obviously we will monitor what's going on we will see and yeah i think that's where we'll wrap out wrap up episode 60 thanks for listening we hope you enjoyed and have a great day

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.