Skip to content

Instantly share code, notes, and snippets.

View rsoltanzadeh's full-sized avatar

Ramin Soltanzadeh rsoltanzadeh

View GitHub Profile
@rsoltanzadeh
rsoltanzadeh / reduce.md
Last active June 24, 2025 18:11
Reduce

Reduce

This is a quest for a deeper understanding of reduce. The language of choice here is JavaScript for purely arbitrary reasons. This discussion is not JavaScript-specific.

P.S. Here is a translation cheat sheet for our C# friends to keep up with the discussion:

C# Rest of the world
Where Filter
@rsoltanzadeh
rsoltanzadeh / dysfunctional_adventure_in_csharp.md
Last active May 12, 2025 21:14
Ett dysfunktionellt äventyr i C#

Ett dysfunktionellt äventyr i C#

Det var en lugn tisdag eftermiddag utan några som helst tankar om vilda äventyr och överraskande förbryllelser. Det var snart dags att lämna kontoret för att handla mat och tvätta bilen. En kort dialog gällande kodstilar för att avsluta dagen, det skadar väl inte?

Vid det här laget är det inte oväntat att äventyret drar med en när man minst anar det, och så var det även denna gång.

Innehållsförteckning

null

I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.

- Tony Hoare


The following is a conversation between Alice and Bob, two friends who seek to understand what the billion-dollar mistake really entails.

Alice: Uh... what? Is null not just the absence of a value? How would we even write code if null didn't exist?

@rsoltanzadeh
rsoltanzadeh / ruleofthree.md
Created August 3, 2024 18:57
Rule of Three

Rule of Three — a short story about money, debt, and banks

Alice is broke and in need of $100 to buy food. She goes to Bob and tells him about her problem.

Bob is actually broke as well, but he keeps quiet about that and presents his idea:

"You and I have never done business together before and owe each other nothing. However, let's pretend that I owe you $100 and you owe me $100 - that still keeps us even."

Bob takes a piece of paper from his desk, writes $100 on it and signs it.

Keybase proof

I hereby claim:

  • I am rsoltanzadeh on github.
  • I am soltanzadeh (https://keybase.io/soltanzadeh) on keybase.
  • I have a public key whose fingerprint is 8BC7 07DA E766 08BC 31E8 D7B9 B4B3 9052 3B3B 075F

To claim this, I am signing this object: