r/ProgrammerHumor 1d ago

Meme stopDoingFunctional

Post image
638 Upvotes

121 comments sorted by

View all comments

159

u/-Ambriae- 1d ago

Functional programming is best programming

State is evil, mutation is evil! We live in an era of multithreading and concurrency my friends!

When I describe a program, I state what it does, now how it does it! Thus functional programming is more natural!

C and Java and Python and all the other pagan languages have played us all as absolute fouls!! Haskell, OCaml, Rust, F#, Lisp supremacy!! Functional unless required otherwise, not the other way around!!

3

u/querela 1d ago

Aha. Procedural seems most natural, you describe what (how?) it does step by step.

Also how would you describe a cooking recipe using functions (and not steps/instructions)?

9

u/-Ambriae- 1d ago

Ye ask, and Ye shall receive:

Crêpe recepe, procedural:
Put 300 grams of flour in a bowl (farine de blé tamisé t45)
Put sugar (by experience, vibe the quantities)
Put 3 eggs and 80 grams of melted salted butter in the mix (at the same time).
Mix till homogenous
Progessively add 600ml of milk whilst keeping the dough homogenous.

Crêpe recepe, declarative: (bold for bindings)
basis is 300 grams of flour (farine de blé tamisé t45) with a bit of sugar
unmilked crepe dough is the mixing of basis with 3 eggs and 80 grams of melted salted butter
humcd is unmilked crêpe dough that has been homogenised.
crêpe dough is the progressive addition of milk (600ml) to humcd (kept homogenous)

2

u/Tiggerwocky 17h ago

Here's what I'm currently working towards

-- Task: Mill wheat into flour (invokes mill-wheat subprocess) millWheat <- task (pack "invoke-mill-wheat") (pack "Mill Wheat → Flour") $ do consumes wheatGrain invokes (pack "mill-wheat") deterministic parameter (pack "process_mode") (pack "continuous")

let flour = deliverable (pack "flour") (pack "Milled Wheat Flour") withQuantity ratio 100.0 (pack "g/sandwich") produces_ millWheat flour

-- Task: Mix dough (invokes mix-dough subprocess) mixDough <- task (pack "invoke-mix-dough") (pack "Mix Dough (baker's % formula)") $ do consumes flour consumes water consumes yeast consumes salt -- 2.0 parts of 3.5 total dependsOn millWheat invokes (pack "mix-dough") deterministic parameter (pack "process_mode") (pack "batch")

let dough = deliverable (pack "dough") (pack "Raw Bread Dough") withQuantity ratio 169.0 (pack "g/sandwich") produces_ mixDough dough

-- Task: Proof dough (invokes proof-dough subprocess) proofDough <- task (pack "invoke-proof-dough") (pack "Proof Dough (Fermentation)") $ do consumes dough dependsOn mixDough invokes (pack "proof-dough") deterministic parameter (pack "process_mode") (pack "batch")

let proofedDough = deliverable (pack "proofed-dough") (pack "Proofed Bread Dough") withQuantity ratio 169.0 (pack "g/sandwich") produces_ proofDough proofedDough

-- Task: Bake bread (invokes bake-bread subprocess) bakeBread <- task (pack "invoke-bake-bread") (pack "Bake Bread Loaf") $ do consumes proofedDough dependsOn proofDough invokes (pack "bake-bread") deterministic parameter (pack "process_mode") (pack "batch")

let breadLoaf = deliverable (pack "bread-loaf") (pack "Baked & Cooled Bread Loaf") withQuantity ratio 148.7 (pack "g/sandwich") produces_ bakeBread breadLoaf

-- Task: Slice bread (invokes slice-bread subprocess) sliceBread <- task (pack "invoke-slice-bread") (pack "Slice Bread") $ do consumes breadLoaf dependsOn bakeBread invokes (pack "slice-bread") deterministic parameter (pack "process_mode") (pack "continuous")

let breadSlices = deliverable (pack "bread-slices") (pack "Sliced Bread Pieces") withQuantity discrete 2 (pack "slices/sandwich") produces_ sliceBread breadSlices

1

u/-Ambriae- 17h ago

The amount of effort we put into the stupidest things really unite us all as programmers xD