@olafurw This is my interpretation:

1. Pick (🤏) a pivot element, then (➡️) split (🔀) i.e. partition the remaining elements according to which one is larger (📈)
2. recurse (🔄) on the left (🔄) and right (🔄) halves until you're done (🛑)
3. Repeat (🔁) steps 1 and 2 in alternating order so that the last thing you perform is step 1

Prophet boosted

After *checks notes* 6 months, I finally finished another blog post!

This time I actually got it working without segmentation faults or undefined behavior.

I did discover a bug in GHC 9.2 though


Prophet boosted

@chshersh @sjoerd_visscher You should probably be able to recover associativity if you merge the `object <> array` case slightly differently.

I think something like
`{ x : 1} <> [2] = { x : 1, data: [2] }`
should be associative?

Prophet boosted

== Structural Logging in Haskell, Part 1 ==

Okay, let's write some useful #Haskell content here for a change.

When you do logging in sophisticated applications, you're generally logging JSON objects instead of raw texts. Most logging query engines are optimized for searching and filtering JSON values.

However, often you get pieces of information from different sources, and it makes sense to combine them into a single JSON object.

On this note, I would like to introduce a function for merging two JSON objects.

I'm a bit confused why I haven't seen this function either implemented properly or at all in any of the projects or libraries I've seen. It looks like a natural way to merge two JSON objects losslessly.

**UPDATE:** As noted in the comments, the below function is not associative which makes its behaviour less reliable and predictable.

> Previously, I was worried too much about the performance of merging two JSON objects and I researched various logging optimizations, including dependently typed statically known maps for optimized merging. But after working on real projects for a while, I realized that performance here doesn't matter anyway.

The full code can be found here:

I also used the new \cases keyword from GHC 9.4 which is perfect for such cases (pun intended).

Happy coding! 🍀

Prophet boosted

x86_64 Assembly

Prophet boosted

Honestly the state of the internet is miserable if you're trying to learn things.

Like, you want to learn how to care for an animal? Well, every Google result is a bot generated fake blog. Maybe try YouTube? Well, you have a few new options: there's the person who just got this animal for the first time talking like experts about them. Or there's the literal child telling you what they learned about caring for hamsters from the bot generated fake blogs they just looked up.

This goes for almost anything anymore. There's no expertise, the only advice is just from whoever is the best at SEO, which is often not an actual person. But if it is they probably know as much as you do.

In the last 6 or 7 years I've found myself more and more just digging up ebooks from people who know what the fuck they're talking about.

@lori A fun consequence of this is that it is usually easier to find information about things that almost nobody uses

Haskell's monads can be used to implement CONEFROM

Today I woke up (went to bed actually) and chose violence apparently.


(Also thanks to cohost.org/leftpaddotpy for the nerdsnipe)

Prophet boosted

1/ Many will tell you why Python is great for teaching coding, so I'll tell you ways it's not.

State is a bad default. It should be legal but safe & rare. The arc of programming is long and bends towards immutability. Its early use creates messes (eg, "a variable is a box".)

2/ Rich and robust programming requires a strong understanding of data models and invariants. Python is weak at expressing either of those. You don't notice it until you miss it. ↵

Prophet boosted

re: cw: stallman epstein take 

"I use Linux as my operating system," I state proudly to the unkempt, bearded man. He swivels around in his desk chair with a devilish gleam in his eyes, ready to mansplain with extreme precision. "Actually", he says with a grin, "Linux is just the kernel. You use GNU+Linux!' I don't miss a beat and reply with a smirk, "I use Alpine, a distro that doesn't include the GNU coreutils, or any other GNU code. It's Linux, but it's not GNU+Linux."

The smile quickly drops from the man's face. His body begins convulsing and he foams at the mouth and drops to the floor with a sickly thud. As he writhes around he screams "I-IT WAS COMPILED WITH GCC! THAT MEANS IT'S STILL GNU!" Coolly, I reply "If windows was compiled with gcc, would that make it GNU?" I interrupt his response with "-and work is being made on the kernel to make it more compiler-agnostic. Even you were correct, you wont be for long."

With a sickly wheeze, the last of the man's life is ejected from his body. He lies on the floor, cold and limp. I've womansplained him to death.
Show thread

re: cw: .NET hate 

@cafkafk it's wild to me how many people there are that have like 40 years of experience, but have never used and don't even know anything besides NET

@astrid@fedi.astrid.tech Same! I still prefer ComputerCraft though, because it is way simpler. Sure opencomputers is more powerful, but it takes so much more effort to get started with anything

@a11ce Minecraft, Stardew Valley, Portal, Terraria, maybe Valheim (this one is more fun with friends though)

Update: apparently, init depends on libcrypto as well, so rebooting caused a fucking kernel panic

Show thread
Show older

A Mastodon instance for programming language theorists and mathematicians. Or just anyone who wants to hang out.