4 ms·
agreed. i think his C# code is intentionally obtuse or something. and the 'refactored' version of the Clojure code with the gnarly bits removed is missing the l
by tumult 17y ago
agreed. i think his C# code is intentionally obtuse or something. and the 'refactored' version of the Clojure code with the gnarly bits removed is missing the logic to actually perform the calculations.
speaking of functional, i'm new to Haskell, but wouldn't it just be
f x = sum [v | (y,z) <- x, let v = y*z, v >= z*2]
assuming the argument is a list of tuples in the form (SDFactor, productionCost)
you could also foldl if you don't trust the compiler to optimize the extra list iteration away.
i didn't really like the article. the tone was really grating. probably look elsewhere if you want some inspiration on functional programming style