this post was submitted on 19 Apr 2024
513 points (98.1% liked)

Programmer Humor

19182 readers
1061 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 87 points 5 months ago (5 children)

Hell yeah, brother. Functional programmers rise up.

[–] [email protected] 34 points 5 months ago (4 children)

As long as you do it without side effects...

[–] [email protected] 20 points 5 months ago
    total_armageddon = launch_nuclear_missile <$> [1...]
[–] [email protected] 10 points 5 months ago* (last edited 4 months ago)

Deleted by creator

[–] [email protected] 9 points 5 months ago (1 children)

Return a list of cloned functional programmers with their positions translated towards positive y!

[–] [email protected] 4 points 5 months ago

Thankfully our immutability makes us immune to fall damage.

[–] [email protected] 5 points 5 months ago* (last edited 5 months ago)

Writer monads am I right? 😅

[–] [email protected] 13 points 5 months ago (2 children)
[–] [email protected] 3 points 5 months ago

I said fuck it, should be a good time passer. 20ish minutes later I want to be a systems programmer. Sounds fun, what can I say.

load more comments (1 replies)
[–] [email protected] 6 points 5 months ago

Haven't used a loop in almost a decade! It's a nice life 😎

[–] [email protected] 2 points 5 months ago

Hell yeah! Groovy programmer here, mapping closures over lists of objects.

load more comments (1 replies)
[–] [email protected] 78 points 5 months ago (1 children)

As your compiler patiently turns it back into a loop.

[–] [email protected] 10 points 5 months ago
[–] [email protected] 32 points 5 months ago (2 children)

I’ve been learning Haskell, and now I won’t shut up about Haskell

[–] [email protected] 2 points 5 months ago (1 children)

I learned some Haskell. Did some problems on Advent of Code and such. But since then I've heard about OCaml, which seems super interesting. Hopefully the tooling is simpler, but I've not had time to try anything yet.

Does anybody have any experience with it?

[–] owsei 1 points 5 months ago (1 children)

Im pretty sure tsoding has some videos with it

[–] [email protected] 2 points 5 months ago

I'll check it out, thank you very much! I approximate it a lot. 🙂🙏👍

[–] [email protected] 2 points 5 months ago (2 children)

what's the appeal of haskell? (this is a genuine question.) i've been a bit curious about it for a while but haven't really found the motivation to take a closer look at it.

[–] pkill 8 points 5 months ago* (last edited 5 months ago) (1 children)

purely functional paradigm (immutable data structures and no shared state, which is great for e.g. concurrency) and advanced type system (for example you could have linear types that can be only used once). Lisps build on the premise that everything is data, leaving little room for bloated data structures or tight coupling with call chains that are hard to maintain or test. In Haskell on the other hand, everything is a computation, hence why writing it feels more like writing mathematical equations than computer programs somehow. It might, along Scala be good for data-driven applications.
Also the purely functional syntax means that on average, functional programming languages will arrive at the same solution in approx. 4 times less LOC than procedural/OO according to some research. Just look at solutions to competetive programming problems.
And even though I'm not a big fan of opinionated frameworks, compare some Phoenix codebase to a Symfony or even a Rails one to see how much cleaner the code is.

But if you're new to FP you should rather pick Scheme, Elixir or Clojure since the paradigm itself can be a little bit hard enough to wrap your head around at first (though Elixir and is a bit imperative, depends on how deep are you ready to dive in), not to mention having to learn about ADTs and category theory.

[–] [email protected] 2 points 5 months ago

My favorite feature is how currying is applied literally everywhere. You can take any function that accepts 2 args, pass in a single arg and return a new function that accepts one arg and produces the result. In Haskell, this is handled automatically. Once you wrap your head around using partially applied and fully saturated functions you can really start to see the power behind languages like Haskell

[–] [email protected] 4 points 5 months ago* (last edited 5 months ago) (10 children)

It's been noted that functional code accumulates less bugs, because there's no way to accidentally change something important somewhere else, and Haskell is the standard for functional languages. Also, it might just be me, but the type system also feels perfect when I use it. Like, my math intuition says there's no better way to describe a function; it's showing the logic to me directly.

Where Haskell is weak is when interactivity - either with the real world or with other components - comes up. You can do it, but it really feels like you're writing normal imperative code, and then just squirreling it away in a monad. It's also slower than the mid-level languages. That being said, if I need to quickly generate some data, Haskell is my no-questions go to. Usually I can do it in one or two lines.

load more comments (10 replies)
[–] [email protected] 17 points 5 months ago* (last edited 5 months ago) (1 children)

Unironically this. I know it's the same assuming there's no bugs (lol), but it's just faster to type and easier to read, at least to me.

[–] [email protected] 10 points 5 months ago (1 children)

I always found map more confusing than loop for some reason. Especially nested.

[–] [email protected] 2 points 5 months ago

To each their own.

[–] [email protected] 13 points 5 months ago

Or sometimes fold them over trees of objects!

[–] [email protected] 9 points 5 months ago

Objects? What is this OOP nonsense?

[–] [email protected] 5 points 5 months ago (1 children)

Immutable in order to protect against parallel code changing the size of the iterable?

[–] [email protected] 9 points 5 months ago

Immutable because the only lists worth iterating over are the ones I define for myself.

[–] KindaABigDyl 3 points 5 months ago

#pragma omp parallel for

[–] [email protected] 2 points 5 months ago (2 children)

Ah yes the X86 instruction set for mapping.

Everything is a conditional branch loop. Always has been.

load more comments (2 replies)
load more comments
view more: next ›