J, APL, the array languages, they're coming to C. This is the this is the first. Welcome to ADSP the podcast episode 42, recorded on September 1st, 2021. My name is Connor, and today with my co-host Bryce, we start off by responding to some tweets, talk about working remotely, and then talk about inverse scans and inverse iota. But so this means that this is episode 42, pretty special episode. We should start off by reading some tweets because we've got we've gotten a lot of tweets.
BryceWhy is it a pretty special episode?
ConorEpisode 42. Come on, man.
BryceOkay.
ConorYou don't know the significance. You know the significance.
BryceI get the reference. I was just I was just not sure if that's the direction you were going. But okay.
ConorWow, come on, man. Uh you gotta you gotta trade some of that decorator knowledge for like nerd swag. Uh um you also gotta sit a little closer to your mic. You sound like you're in like the Notre Dame.
BryceI I think that's just my my ceilings are very like I don't know that that's gonna get better.
ConorAlright, so feedback from feedback from listeners. We're reading feedback because there's primarily one thing I want to read out, but we'll read out a bunch of things. So a few episodes ago, we were talking about creating a new acronym based on C companies because NVIDIA is not in the FAIN uh acronym.
BryceSo we were talking about That's not the only reason that we dislike FAIN. We were also like We don't dislike FAIN. I I dislike FAIN. I don't like that like I feel like like it wasn't about NVIDIA. I was like, why is Netflix on there, but Microsoft isn't? But yeah, no offense to people who work in Netflix, but I don't understand why you're why you're classified in the same league as those other companies. And and I guess like part of it is a number of those companies in Fang are platform companies, you know, like good Google and Apple both have like this huge developer ecosystem around them. That's not the case for Netflix. It is the case for Microsoft. Um, so I I just sort of find it well, and and I think also like you know, in many ways it is the case for Facebook too. There's an ecosystem around Facebook. Um, but like Netflix is a different type of tech company um and a different type of tech giant. And so I think that it's a little bit out of place for for it to be in that group. It's like no offense to Netflix. Like, it's a great company, obviously it you know, produces a great product. Um, I think it's a really cool place to work. Um But I think it's um I think it's a different type of tech company than the rest.
ConorBut anyways, I agree. I th I would I would venture a guess if you had to name like the top five. Well, I'm not wanting to say paying, like salary paying slash like employing like large employers of developers, that's not like niche, like you know, so like ignore Wall Street because obviously they pay a ton to devs. Like the first ones that come to mind are like Apple, Amazon, Facebook, Google, and then like Netflix is known for uh paying ridiculously well. Like their whole thing is that you don't even really need to you don't even really need to like salary negotiate. They do a ton of like industry research on what top dollar is for their position, and then they pay that to you almost entirely in base compensation. Like they don't really have like a variable component because their philosophy is if you no longer like working there, they don't want you sticking around because you've got like RSU's ving, which is like the complete opposite of like Amazon, which is their vesting schedule is like 515 4040, which means 80% of their RSUs are paid out two years in the last two years of like a four-year stint.
BryceBut but like like out of the that list of like well-known companies that like pay well that you just listed, I think it's it's really hard to make that list and not include Microsoft. Like, like, look, I I understand you don't include NVIDIA in that list because we're not in the same class as those companies, but I think it's really hard to talk about Apple, Google, Facebook, and not also talk about Microsoft.
ConorYeah, that's true. I guess that it's so it's a bit of you can make the argument for Netflix and then backronym it, right? Because you had AAFG, and if you add M, I think we already talked about this. What do you get? You get you get GAMFA or something like that. Yeah. Whereas if you if you if you What did this listener have to say? Oh, so so we had said, let's create our own acronym. Uh we were talking to Sean, so it was Adobe, Netflix. You wanted to include Microsoft because they were left out of the Fang. Yeah. And so we and so we said, well, what word could we go for? And I mentioned Maine, if we could find an I, a company that started with I. And so we had a we had uh if I apologize if I mispronounce any of these names, I I uh profusely apologize. But Mahir uh Vadya said, uh, which company starts with I? Inner voice intel. Inner voice intel voice. Okay, we will let the listeners tell if any company starts with I. Uh funny that neither of us thought of Intel considering.
BryceWell, I thought of Intel, but um I think we I think I thought we said Intel.
ConorWe did not. We can we couldn't come up with we could not come up with a company that started with I, so my question is is do I have to cut this whole part out of the episode?
BryceOh, because we're not supposed to promote Intel? Um Well, no, they're not really our rivals. We're in a class bar on. Um, no, I like it. I like it. Main Microsoft, Adobe, Intel, Netflix.
ConorNetflix, NVIDIA.
BryceOh I I would claim jet lag, but uh that's probably not gonna hold up.
ConorI mean, uh Eric uh Eric Keane, right? He works at Intel. He's a he's a class act. I love uh he's really great. Yeah, and uh and Jeff Hammond, he just came from Intel, and he's a super nice guy. So the of the people that I know that have come from or are at Intel, they're they're lovely people.
BryceSo yeah. Yeah, yeah. No, and I mean Intel's Intel's a cool sh like and you know, one of the interesting things about that acronym is it doesn't name all of the big C orgs, but it gets most of them. Um Intel's big and invested in C. Uh, so is Adobe. It's a classic C shop, and so does NVIDIA.
ConorOutside of the Fang companies that also are, what would you name? Bloom Bloomberg, obviously.
BryceYeah, yeah, we would have to work Bloomberg in.
ConorDo we have to work Bloomberg again?
BryceAll right, so do we need a new Yeah, because Bloom Bloomberg, Bloomberg is one of the um Bloomberg is one of the largest investors in the C ⁇ community. Yeah. Um it's one thing that you know Bloomberg does a real like if you look at if you look at um financial tech companies of which Bloomberg is it it would be wrong to classify Bloomberg as like an HFT company because that's not what they do. They're they're not an HFT firm, but they they provide, you know, these um uh it's almost like market services, you know, data information, you know, the the the this stream of information about various markets. Um so like in some ways they're sort of like a news, you know, or but they're definitely like, you know, I think they fall under the guise of financial tech. But um there are a few others that invest in the C community, like Citadel, but by far the most present one is Bloomberg. I I learned I learned something interesting about Bloomberg. Um, because I was having dinner with with one of my colleagues, Alistair, who works at Bloomberg, and he told me that at Bloomberg, they've got so so they're based in Manhattan. Um, and until a few years ago, they they were they didn't like remote work because they felt that you you lost something, um, you lost some element of collaboration by not having everybody local. But they did this other thing, which is very interesting, which is they've got three or four different sites within the city. And every few years, you get moved your your team and your org moves where your office space is. Maybe within the same building, but also maybe, you know, maybe you move from one of the offices in Manhattan to a different office. And this consistently happens every few years, that everybody gets moved. And it's like important to them that everybody gets moved so that you don't get used to being in one place. Um, and the idea is that like you move around, you you move around where all the different teams are to so that every few years, hey, you're sitting next to a new group of people and you get exposed to a different part of the company. Um, and then that way, like, there's more chances for synergy. Um, and that it's something that becomes a regular part of the culture. So, so once like if you if your desk is going to be moved every year, you know, one, the company gets used to doing these moves, and two, you, the employee, get used to it, so it's not a big hassle. So I just thought that was interesting.
ConorYeah, that is interesting. I've never heard of anything like that. Um other than sort of like open office or open concept where you don't really have a desk and you just float around. Yeah, like I think that's slightly different.
BryceI think Valve does that.
ConorYeah, I was at an insurance company before I was a dev that ended up doing that.
BryceReally? But let when you think of like innovative um uh office seating practices, you don't think of insurance companies.
ConorYeah, I mean the company that I'm I was referring to as Manulife, and they um they tried to they're trying to be they they developed this was after I left, but I heard that they set up a team called Loft, which stood for the Laboratory of Forward Thinking, where the where where they were trying to generate these really unique, you know, insurance ideas and policies. So like I think I'm not sure if it was out of ManuLife where they copied another company, but I definitely know that there's a policy in Canada through Manulife that you can get where you wear a Fitbit and it keeps track. It's like a an insurance company issued Fitbit and it keeps track of like how active you are, and you can get like a reduced premium by doing exercise. Um and also there's similar things for car insurance in Canada where you can get like little brake measurements to see like how much you're braking and and you know, sort of like how safe you're driving and whatnot, and that affects your insurance premiums for for vehicle insurance. So there's some neat ideas.
BryceThis is a thing, this is a thing that um that's not as common these days, but I I actually I was reminded of this because I was watching an episode of uh the TV show Mad Men. Uh I've been watching a bunch of New York-based TV shows to get myself in the in the New York mood. And uh, and also if we're being honest, uh uh Mad Men has a lot, a lot of the furniture in Mad Men is mid-century modern style, which is the style that I prefer. So I've been watching TV shows looking for looking for decorator ideas. But um uh there's there's one episode where one of the main characters is going to get his physical, and the doctor says, oh, like, you know, you're you're only in here because your insurance company is requiring it. Um and this like used to be a thing where like for your life insurance or your health insurance, your your insurance- and maybe it still is, but maybe it's just that people of our age don't have that requirement. But it you it might have used to be back in the day that your insurance company would require you to go get a physical every few years and then you know send them the results, presumably. I think today people would think of that as an invasion of their privacy. But I mean, maybe it's still a thing. Who knows?
ConorUh I think definitely it is for certain policies. You have to be quote unquote underwritten. Yeah.
BryceWell well, so let me let me ask you this. So you um when did you move back to Canada?
ConorUh 2019.
BryceBefore pre-pandemic, of course.
ConorYeah, just a few months before the pandemic, yeah.
BryceDo you think um and and you were on a team that was a remote that that was a remote first team, by which I mean it was a team that was remote even before the pandemic.
ConorYep.
BryceThe Rapids team at Nvidia. You think you'd ever want to go back to working in an office?
ConorUh so the answer to that question is if I have to choose 100% remote or a hundred percent in the office, I will always choose remote. The flexibility that you get and the time that you save from like not having to commute, I think it's it outweighs the benefits of being in the office. I definitely miss being around people, uh, like especially COVID times. I essentially live by myself and I'm just isolated, except for when I socialize, which isn't often because it's still sort of pandemic-y. And uh so yeah, like if I had it my way, like there's an NVIDIA office, and I would probably go into the office for like two half days of a week when I had like meetings, and I just take my laptop with me. I wouldn't have a desk and I just sort of there's a a space in the sort of like kitchen area where you can you can grab a place by a window and so you get to see people, you get to whatever chat a bit. Um, because I definitely miss that like water cooler aspect. Like it's sort of hard to replicate that, especially when I've only met like four or five of the people that I work with in person.
BryceYeah.
ConorBut yeah, the convenience of like being able to make a sandwich or you know go for a quick run in the middle of the day. Like when you're at work, the overhead of going to the gym or going for a run where you have to, you know, then shower and bring extra clothes and blah blah blah and all this stuff, it's just just a headache. Um uh yeah.
BryceSee, it's interesting that that you say that that you would go in for meetings because pre-pandemic, the days that I had all meetings might would the days that I like wanted to stay at home, because uh at the NVIDIA headquarters is like an open office plan. I can't have my meetings, I can't take my meetings from from my desk. Well there is a tolerance to how many meetings I could take from my desk before I would get you know glares from my coworkers and would need to go get a you know a meeting room. So those are the days that I would almost prefer to be at at um at uh at home. Um and like I I used to think, because I was a big believer in like, you know, uh that it was important to separate your work space from your living space for like work-life balance, um, because like I could I have a tendency towards being a workaholic, so I thought I used to not have a desk at home. Um I used to try to never have a workspace at home so that I would have to go into the office when I wanted to work. Like I did that when I was at Lawrence Berkeley Lab. Um I I uh I well also when I was at Lawrence Berkeley Lab, I lived in this miserable little apartment that had like no AC and no ventilation. So you didn't want to be in there during the day, anyways. Um uh but uh I I uh at this and same thing when I was in Santa Clara, when I was at NVIDIA headquarters, I was I I lived in a smaller apartment that didn't have space for a home office or a desk that was really near headquarters, with the thinking being, okay, if I want to work, I'll drive five minutes into the office, and then a home space is the home space. And then at the start of the pandemic, I was like, well, I'll have to find the I'll have to figure out how I can fit a small desk into this tiny apartment. Um but I don't think I would go back because no matter how short your commute is, um at least for me, and I'm somebody who's you know had ADD my whole life, the the fact that I had to get up, put on clothes, you know, pack a bag of all the stuff I would need for the day, you know, eat a meal, get in a car, and drive any amount of distance, like those series of actions were a barrier for me to start working. Um and uh it was also a barrier for me to stop working. And that was actually the more problematic part. That if I was at the office and I was sort of like at the end of my, you know, I'd run out of energy, but I like wasn't finished with my task, um I couldn't decide to just go, you know what, I'm gonna have dinner now, maybe I'll come back to this, you know, for 30 minutes after dinner. Or, you know what, I'm just I'm just gonna go take a lunch, or I'm gonna go watch, you know, something on Netflix for an hour. Now I could do that middle thing of like I could go like, you know, just sit at my desk and watch a video on YouTube at the office. Um but making that decision to return to the to the living space was a thing that I would do once during the day. So it was like a big decision. It was like once I decided I'm going to go home and be at home for some period of time, then I have stopped working for the rest of the day. And for me, like the greatest thing about being working at home is that I can choose when I make those transitions. Um and it's not a commitment. So that makes it easier for me to start working and easier for me to stop working. And I think that that's actually led to me to have a better work-life balance than I previously had. Um, you know, if I reach the end of my day or like a period where I feel like I need to stop, you know, I'll just do it. Um or if I just like if I'm it's the middle of the day and I'm not feeling like, you know, I'm just not feeling energy right now, maybe I'll just stop and I'll go, you know, start cooking dinner or something. Um or you know, go do some shorts, some errands around the house. Um, and then I can go return to work later. And it just it just feels um it just like the ability to switch between those two things, it's just a much better fit for me. And I never would have guessed it before the pandemic.
ConorYeah, I would have to say that I don't think I ever it's it would be very rare if I ever sort of start my day and end my day within like a nine hour um like fixed window, especially due to the fact that my compile time is like 40 plus minutes. I'm I'm constantly like in the evenings, even when I'm quote unquote not working, like just still iterating on something that I know if it's gonna take you know half an hour plus to compile, I'll be doing my own stuff and I can still I can still like make quote unquote like three to four hours of progress where I'm really only working for like less than an hour, but it that's gonna take like you know, half a day of compile time stuff, then uh I've gotten to a point where the the stuff that I'm doing, um most of it is like strategy and planning.
BryceAnd so if I do have a c a task that involves me like compiling, or like for me, it's the it's maybe less the compile time, it's more like building like getting CI results back. I'm lucky in that now I'm at a place that I have a small enough portion of those tasks that I can always overlap them with something else. But uh, but I my one of my ex-girlfriends got me a signed copy of the XKCD comic where it's showing two programmers like fighting with wooden swords, and um uh there's like their boss saying, Hey, get back to work, and one of them's like code's compiling, and it says under it the number one legitimate excuse for programmers slacking off. Um yeah. But yeah, like like I I don't ever really work nine to five days, but um I have I s I have days that are meeting days and I have days that are work days, and I try to like I try to not have meetings on days where like I want to get work done. Like I try to have all my meetings on Mondays and Wednesdays, but um it it ends up where now I do have some on Tuesdays and Thursdays because I have some committee meetings on Tuesdays and some other work meetings on Thursdays. Um uh but uh you know like I might every now and then I have that rare you know Tuesday or Thursday where I have nothing to do and I can just say, hey, from nine to five, I'm just gonna work on this thing. And I usually like take like one break in the middle of the day. But um like for me at least like when I when I when I have that rare like chunk of like free time, like once I get started working on the thing, like I can just go and work on it for like, you know, a good chunk of a good chunk of eight hours. Um it's just like the getting started that's uh that's challenging and finding that time.
ConorYeah, there's a huge overhead to contact switch contact switching.
BryceYeah. Yeah.
ConorAlright, so back to we went on a couple of huge tangents there. Um but we got we got one tweet read at least.
BryceYes. All right, let's let's let's go back to another user tweet.
ConorUm there was a couple tweets along the same lines. So Sean posts his uh car crash story. Um hopefully hopefully uh everyone has listened to that episode that's listening to this episode now. If not, find it in the show notes and sorry for the spoiler. A couple of them said that uh feel like Sean Parent missed the this is from Gregory Thane. Uh feel like Sean Parent missed the punchline of his story, drove Apple's Porsche too fast around a corner, spun out, smashed the rear end uh into a telephone pole. That's a rotate. Um which I thought was pretty funny. Um and yeah, John Mullins said the same thing. That's a rotate gone wrong.
BryceUm audience, uh I I love you all.
ConorAnd then uh there's a couple different um folks that have replied or retweeted saying that uh has become one of their favorite podcasts. So Pegman was one of those individuals. So thanks. And also uh we're getting to the top.
BryceUm well and and you're you're missing the one, you know, people are pointing out the new name for the podcast.
ConorYeah, yeah. So that's the one we're getting to. So Sam McDonald on uh August 27th, and then I I retweeted this saying this is uh unoffici now uh officially the unofficial title of this podcast. It's probably the best backronym I've ever uh come across. And Sam tweeted, ah, always glad to see a new episode of ADSP aka a discussion with Sean Parent. Which is amazing because uh definitely we've had uh Sean on, I think we've interviewed him three times, but that's been split into like eight or nine episodes.
BryceLike eight, yeah, at least nine episodes, yeah.
ConorAnd um and yeah, Matt Gobolt also tweeted out the other day that uh he's been catching up on the podcast and really enjoying it um and learning about things he didn't think he'd learn about, like APL. And Matt, for those of you that don't know, also has his own podcast called Tooth Compliment, um, which is definitely worth a listen. Oh, snap! And I didn't even see this one. Um another backronym, actually, that's a scan podcast. That's not too bad. That's uh share that's from share the parens with your friends. Which is an amusing um an amusing uh handle. Anyways, yeah, we were supposed to talk about um we were supposed to talk about something.
BryceYeah, yeah, well. Because I didn't get the memo.
ConorI was so we're gonna have to save it till I'm not even sure because I it would have been nice if episode 42 was talking about this. But so while you were, you know, moving and packing and we weren't recording uh during August, uh on my other podcast, Arraycast, I learned one day that APL and Jay have inverse scans.
BryceSo so okay, yeah. So I think you mentioned this to me somewhere, and I expressed some confusion.
ConorI think you just saw the tweet, and then you were like, you commented on it and were like, what's an inverse scan? And then you said, or is that an episode of ADSP? And I said, Yeah, we'll wait. We'll wait to talk about it.
BryceSo explain this to me because I'm really I'm really ha so like a scan is um If you want, you tell me what you think an inverse scan is, and I'll tell you a lot of it. Well, well, okay, let me just talk through this. So to me, a scan is of the family of you know, a reduction. It it's where where a reduction produces like one final result, a scan produces all these intermediate results.
ConorReally? You consider a scan a reduction? That's interesting.
BryceNot not a reduction. I consider it of the family of a reduction. Um because uh you know it it produces all these partial sums. Um uh I think there are a lot of there are a lot of problems where that that you might solve with a reduction where a modified version of that problem might be solved with a scam. Um yeah, I think that they're very similar. Um and I think that they have a lot of similar properties in terms of like how they propagate information um and in how they deal with things like commutativity and uh associativity. Yeah, I'm gonna stick with that. I I'm I'm I'm sticking with my my claim here. Um so then the idea of an inverse scan immediately makes me ask, what would an inverse reduction be? And I have no idea. Um but I mean I guess I guess I would I would think that an inverse reduction would mean information propagates the other way. Um a reduction produ produces one result from many, so maybe an inverse reduction would um send one result out to minis. But I I don't know that that helps me at all guess what an inverse scan is.
ConorWell, so here's a clue is that in APL and J, I I believe inverse reductions are not possible at all.
BryceOkay.
ConorAnd in fact, there are certain inverse scans that are not possible. Only certain types of scans can be inverted. So for actually I'll pause there until you unless if you want another hint. And then if you want, I can give you an example of a inverse scan that can be inverted. Or a scan that can be inverted and a scan that cannot be inverted.
BryceYeah, give me yes, yes.
ConorYou want those hints? Okay, so a plus scan can be inverted, but a max scan cannot.
BryceWhat properties does max have that plus does not have?
ConorThis is fun. Listeners can play along. Maybe this will be a longer episode. We'll just we'll go way past the 30-minute mark.
BryceUm What properties does max have that plus doesn't have? Hmm.
ConorYou should you should a ask yourself what properties does the result of a max scan have versus a plus scan? Because both plus and max are both associative and commutative.
BryceSo Right, right. That's property wise just getting to that.
ConorProperty-wise, they're very similar.
BryceUm does the result of it have.
ConorUm And here, I'll give you even another hint, because this is I'm getting too excited sitting here. Tech technically, the equivalent of an inverse scan exists as an algorithm in the C standard library.
BryceIs it like an adjacent is it is the is it adjacent difference? It is. Yeah. Okay, I I I I see where I see where you're going with this. I think. Which is like the inverse of a scan, is like it's like an adjacent difference, so it's just like the localized values.
ConorSo tell me to stay in the Ctopia for a little bit. Um, and this is uh this was first pointed out to me by Christabella um when we were uh discussing whether or not adjacent difference was um was broken or not. Because I I have for a long time maintained that adjacent difference is broken because it it returns you n elements and it copies the first element of the input range to be the first element of the output range. Listeners of this podcast have probably heard me say that like three or four times by now. Chris's take was that it's not broken because the desired behavior of adjacent difference was to be able to round trip with partial sum to get back the original input sequence. So if you partial sum on the values one, one, one, one, one, you'll get back one, two, three, four, five as the partial sum. And if you then take adjacent difference, you can round trip back to your initial input. And so there's this.
BryceI don't see how you would round trip if you were doing maxes.
ConorExactly, yeah. So when you do a max scan, um, you cannot do the inverse of that because you have you've lost information whenever you have sort of local minimums in between values. Whereas a plus scan inherently encodes every single piece of information uh in between like adjacent elements.
BryceBut there is there is somehow that is in some way a property of max versus plus. I don't know how to. And you know what? I I I I will argue that there's probably there are I assume when you said plus, you meant plus on like integers.
ConorAs opposed to I don't know, like plus on strings or some other Uh well, so if if plus is defined as catenation, it would still work, right? If you had the characters or the strings A B C D E F G as all individual characters, and then you did uh What about what about on like floating point numbers?
BryceBecause you're gonna have information loss there.
ConorI mean, floating point is like there's always an asterisk next to that because of NANDs and stuff like that. But I mean and and and precision and whatnot, but arguably you can get back, you know, minus some precision and minus the corner cases of floating point, you can get back your results.
BryceHere's another one. What about like um what about like a Boolean operator?
ConorLike um, that also would not work, yeah.
BryceSo if you wanted to do like something something like an all of, you know, because you're gonna lose information there too.
ConorYeah, if you well, so all of is a reduction, but if you did the equivalent like logical and uh scan and you had the sequence like zero, one, zero, one, zero, one, that'll return you zero, one, one, one, one, one, one, one to the end, and you're only gonna be able to find you know the first element that was a one, and then you've lost all information. So yes, it has to basically your binary operation combined with the scan has to encode each of the values in the adjacent values. And if your binary operation does not do that, then it's not invertible.
BryceSo so that property, there must be a name for that property. I wonder if there's um if there's a mathematical or a name from CS theory for that property.
ConorI do not know it if it exists. And it's it's interesting.
BryceMaybe one of our listeners will. I'm not you.
ConorI'm not sure it's so much a property of the binary operation as it is like the resulting scan combined with the binary op. Um because like a plus like if you go one plus two, you get three, but like just looking at the binary operation on its own, you've lost all information there, right? The same way if you have like one max two, you get back two. You've lost, was it two, zero? You only know you you've lost information. But it's it's the combination of the scan with the binary operation.
BryceWell, it it's some property about whether there exists like this inverting operation where you can take you can can you take two of the results that are next to each other and recover the original from it. Right? Like, is there some operation that exists that you can take two of the partial sums and get back the original values?
ConorRight, yeah.
BryceYeah. And I don't know what that so yeah, I bet that there is I bet that there is some mathematical term uh that describes this.
ConorWell we've got uh we've I don't know how many, we get on average like a thousand listens an episode. If uh somebody will if you're a if you're a math background at us uh on Twitter, and if you don't have Twitter, you can find us on uh GitHub on our get on my GitHub repo. Or just go to the website, yeah, and that'll take you to the GitHub repo, and you can you can post us a note. Um I'd be very curious to know.
BryceSo so is so how different is an APL um uh inverse scan from like a generalized adjacent difference?
ConorUm a generalized adjacent difference. So like on a plus scan, it's basically the exact same thing.
BryceWhat I mean is like adjacent difference is not like it, yeah, I believe it has like um it has like the minus hard coded in, etc.
ConorWell, it's the default binary operation. Um but yeah, so like if you do an inverse plus scan on one, two, three, four, five, you will get the exact same result if you did an adjacent difference on one, two, three, four, five.
BryceUm and it's funny because we also have a name for it for the generalized adjacent difference.
ConorUh we're getting adjacent transform in ranges because that's a better name. And that's the one with the n minus one behavior.
BryceBut so so is an inverse scan adjacent transform in C ⁇ ?
ConorNo. Um I mean an inverse scan is just the inverse of the possible scan. Uh we Right, right.
BryceBut is the is the way that you would express that in C ⁇ adjacent adjacent transform?
ConorI would express it with adjacent difference, because it actually it actually that means.
BryceRight, but but you can't always but that's only if it's a plus scan.
ConorUm it's uh only if the binary operation is quote unquote invertible for the lack of the word that we don't have for it. But yes, right.
BryceBut well, but but no no, it it's that's only if the uh hang on. If if uh if the inversion operation is an overload of adjacent difference, it takes a binary operation. Yeah, yeah, yeah. Okay, yeah.
ConorOh sorry, yeah, that's that's what I was like I I was thinking, yeah, if you're doing multiple like a multiply scan, you can get the inverse by just overloading the we only we only added the overload of adjacent difference that no we have.
BryceNo, it's been there. It's been there since C then.
ConorYeah, yeah, yeah.
BryceUm yeah.
ConorAnd the whole other extension of this topic is that you get this inverse scan by doing uh using the power operator in APL, which usually you use with a positive number. So if you want to perform some function two, three, four, five times, you go power two. But you can also go power negative one, and that inverts it. And that works on a variety of different functions.
BryceSo there's also explain that. Oh, okay. You apply the power, you apply the power operator to the scan operator.
ConorCorrect. Um, and so then you What happens?
BryceWhat happens if you do a power two to a scan operator?
ConorUh I believe it's gonna scan twice. Do a plus scan twice. So if you start with one, one, one, one, one, you're gonna get back one, two, three, four, five. And then if you do that again, you're gonna get back one, three, six, ten, fifteen, twifen, yeah? Is that right?
BryceYeah, it's almost like a like a derivatives.
ConorLet's uh really quickly that is kind of like a derivative. Do you want me to share my screen?
BryceYeah, go for it. Users, I am now looking at a screen with a bunch of symbols.
ConorSo if we do Quirky symbols. If we do they look like Egyptian hieroglyphs. That's reduction. So we got plus scan once. And then if we uh do power two.
BryceOkay, the power symbol is a little asterisk with two dots above it.
ConorIt's called the diurasis. Diarysis? Yeah. Diurisis. Um it actually really makes a lot of sense. The power by itself, if you do two power five, you're gonna get 32 because it's uh exponential. Um and the the diurisis typically is used to denote an operator. So it's basically like just a power operator, it's exactly what it is. Um and so yeah, if you instead of uh if I go iota 5 back to iota 5.
BryceWait, why did you not use iota in the previous example?
ConorBecause we were we were starting with uh we were starting with five ones initially. So we went from five ones to one, two, three, four, five because of the plus scan to one, three, six, ten, fifteen because of the power two. Um but if we want to do an inverse scan, we have to start with iota five and then do uh plus scan plus scan power negative one, and this is gonna give us back five ones.
BryceSo you want to see some why wouldn't we do why couldn't we do that? I'm confused. Well, what's the one?
ConorWell, so if we did it with let's see how well you understand it. Say if we do if we replace the iota five, so instead of doing an inverse plus scan on iota five, which is one, two, three, four, five, we do it on five ones. What are we gonna get back? Do you know?
BryceIt's gonna be like one, zero, zero, zero, zero.
ConorLook at that. Bryce an APL expert. So, so here's here's the real fun. What if we do iota inverse on one, two, three? What's this gonna give us?
BryceIota inverse. Um What is the inverse of an iota? Wouldn't that be like a sequence of ones?
ConorSo remember, it gives us back it basically gives it's like uh what did Adam from Arraycast um and dialogue he explained it as sort of Jeopardy, you know? It's uh what gives us the sequence one, two, three when passed to IOTA?
BryceUm iota, I don't think of it iota as taking I think of it iota as generating the sequence one, two, three.
ConorUm but what what do you have to pass to it in order to get it to generate that?
BryceOh, like three?
ConorExactly.
BryceOh, interesting.
ConorSo APL's got inverse schemes, it's got inverse iota.
BryceYeah. But it's interesting, it gives you a scalar, a scalar result, I guess that makes sense.
ConorI mean, it seems like a pretty useless um algorithm to me. Like what's what are you gonna use an inverse iota for, other than to check maybe that you have a monotonically increasing sequence that starts at one?
BryceYeah, what happens what happens if you gave it if you gave one, two, four to um to inverse error?
ConorWhat do you think's gonna happen?
BryceUm gives you an error. Gives you two, maybe domain error.
ConorBecause it's not a valid IOTA sequence.
BryceUm I I could imagine cases where that would be useful. Like um if you wanted to check that people weren't plugging if you wanted to check that people weren't plugging IOTA sequences into your unit tests because you wanted actual real data, you know, could be a useful algorithm.
ConorYep.
BryceBut yeah, no, it's not super useful.
ConorIt's pretty awesome though. They've we've got so any and basically any verb, not all of them, a lot of them you know don't work, but if you can think of a reasonable inverse for a function that you have, um it typically is there.
BryceUh which is so should should ranges have a uh should we have a range adapter that uh inverses that inverts an algorithm? Would that even make no that I don't know that that would work, but or it should should we have some CPO that inverts another CPO? Oh this is actually this has actually come up. We've talked about this before. We've talked about a flip operation. Or maybe it may, I don't know if we talked about it here, but I think either you and I have talked about it or it exists in Boost HANA, right?
ConorYeah.
BryceYeah, yeah, yeah. I think either you and I or Chris developed no, I think it's been you and I who have talked about it, right? Because didn't you want flip for some Oh yeah.
ConorI I I go on and on about flip. It's the it's the C combinator, aka Cardinal, cardinal bird.
BryceSo if but if we're gonna have flip, then shouldn't we also have invert?
ConorI mean, invert is not a combinator. Invert is just a cool operator that that takes a function and gives it a lot.
BryceThe way I imagine it works in APL, just based on those examples you showed, it's not something where it's a generic algorithm, right? Like it's something where that like iota know like it's not some generic thing that like takes iota and knows how to invert it. Like that's like some special wiring of logic that says, hey, like here's how you invert an IOTA.
ConorYeah, so I I think for the the verbs or functions like where, inverse, and scan, those do have like a table lookup where it's like, oh, if it's if it's a plus scan, this is the behavior or whatever. However, that being said, I do know that if you build up a point free or tacit expression that consists purely of what? Like if you build up a tacit expression or point-free, which means that it doesn't mention its arguments.
BryceI was about like you use some words there and then you like glided over them in your explanation. Yeah, continue.
ConorUh but if you if you so I my understanding is that there's some sort of I don't know what the r algorithm is, like recursive def descent or something like that, but like a composition of uh functions that all have inverses can also be inverted.
BryceUm Yeah, yeah, yeah, yeah. Yeah, yeah. That I I'm sure that there's some generic form like, but but there's probably cases where the generic form falls apart or something. Um falls apart. And where there's probably oh let me put it in the right. There's probably cases where there are generic algorithms where there where there are invertible algorithms that you, the user, could write, but that um you would have to somehow customize APL's inversion operation to explain, like imagine that IOTA was not a part of the core of APL. Um and you wanted to write your own IOTA. You'd probably have to express to it in some way how that inversion would work.
ConorSo this is at the limits of my knowledge, but um that is exactly what is possible in J. So in J, I believe they have an operator called Ubverse. Um why it's called that, I'm not sure. But uh Ubverse enables you to define the inverse of a user-defined function. Um, from my if my understanding is correct, which is pretty dope.
BryceWell, so so so so maybe maybe that's a thing that we should have in C.
ConorLike we should have ladies and gents. Look at that. J APL, the array languages, they're coming to C. This is the this is the first step.
BryceYou you act you act as if like I can just like unilaterally decide what C does.
ConorI mean, you are chair of Louvre, right? Isn't that like half the reason of this podcast? Is so that I can uh slowly warp your mind until uh I don't know about this proposal. It doesn't mention APL anymore anymore.
BryceI am chair as library evolution, but um as as as evidenced as recently as the past 24 hours, it isn't it it increasingly becomes clear to me that the chair is more a servant of the uh of of the participants than one might imagine.
ConorWell, that sounds like a good place to end it.
BryceWell, or let me let me put it another way. When you're chair, your job is no longer to um individually contribute. Your job is to help make sure that uh that everybody else's individual contributions get uh a fair hearing and uh and move ahead in a timely fashion.
ConorA moderator.
BryceYeah. Yeah, a fancy moderator. Yeah. And and I some somebody just told me that it's not actually required for me to move to New York to take over Titus's role as library evolution uh chair. I assumed that there was some throne that I had to go and and take from him, but uh but not so much.
ConorThanks for listening. We hope you enjoyed and have a great day.