memesearch
Simple Go, Complex Haskell

Simple Go, Complex Haskell

Download Find similar pictures
Text on the meme
An idiot admires complexity, a genius admires simplicity. package main import "fmt" func gcd(a, b int) int { for b != 0 { a, b = b, a%b } return a } func main() { fmt.Println(gcd(69, 42)) } import Control.Monad.State import System.IO type GCDState = (Int, Int) step :: State GCDState (Maybe Int) step = do (a, b) <- get if b == 0 then return (Just a) else return (b, (a `mod` b)) >> return Nothing gcdRecursive :: State GCDState Int gcdRecursive = do result <- step case result of Just v -> return v Nothing -> gcdRecursive computeGCD :: Int -> Int -> Int a b = evalState gcdRecursive (a, b) main :: IO () main = do hSetBuffering stdout NoBuffering putStrLn $ show (computeGCD 69 42)
What it means

The meme contrasts a short, straightforward Go implementation of the greatest common divisor with an elaborate Haskell version using monadic state. The joke is that the supposedly genius approach admires complexity, while the idiot's approach is simple and readable. EN: The meme contrasts a short, straightforward Go implementation of the greatest common divisor with an elaborate Haskell version using monadic state. The joke is that the supposedly genius approach admires complexity, while the idiot's approach is simple and readable.

Objects
Tags
Source
Type
image
Size
800×636 · 63.2 KiB
Mood
sarcastic, absurd
Language
en
Added