9 ms·
Not reproducing the full comment does not constitute a misquote. Using Clojure doesn't enable you to magically write perfect code. You posted well written Cloj
by snprbob86 17y ago
Not reproducing the full comment does not constitute a misquote.
Using Clojure doesn't enable you to magically write perfect code. You posted well written Clojure and poorly written C#. You can write poor code in any language.
If you wished to remain on the topic of imperative vs functional, you should have avoided phrases like "using C# as the tool has added a huge degree of ceremony". You made a direct attack on the language, not on the coding style. You also make significant mention of the number of lines of code, but it seems as though you have intentionally included boilerplate to make your point. Being misleading and deleting comments are not ways to make an effective case for your cause.
EDIT: Oh, and on the actual subject of functional style. I still much prefer the C# approach as it reads in order you perscribed:
1) calculate liquid value of each item
2) filter candidates
3) accumulate value
(from asset in assets
let liquidValue = GetLiquidValue(asset) // 1
where DoubleMargin(asset, liquidValue) // 2
select liquidValue).Sum() // 3
Compared to the Clojure which reads:
(reduce (sum-field :productioncost) 0 ; 3
(filter doubleMargin? ; 2
(map attach-liquid-value assets))) ; 1
or the Python which reads:
sum(liquid_value # 3
for liquid_value, asset in assets
(get_liquid_value(asset), asset # 1
for asset in assets)
if double_margin(asset, liquid_value)) # 2