150 days ago · Tech · hide · Fediverse post

In my RSS reader, I stumbled upon this code-golfed (i.e. minimised to death) snippet that's fairly clever, but from the code, utterly opaque. I couldn't immediately see how it worked, and since Copilot autocompletes most of my code for me - whether I want to or not, I figured it was a good bit of practice to decompress and understand. First things first: snooze the little copilot bastard for an hour! Side note: because I got this post through my reader, I didn't happen to clock the link right after (in the newsletter) that read "a Redditor breaks down exactly what's going on". So…um…yeah, I guess wasted energy, but probably good for my brain. Here's the original author's code: const signal = F=>(f,G=F)=>F=f?_=>f(G?.()):F?.(); // 33 bytes The crux is that it creates a wrapped stack of callbacks. Effectively recursion through locally defined (and overwritten) variables (G in this case). I started by unpacking the implicit returns so I could see more of what was going on (and renamed F…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town