4 ms·
That wasn't quite a fair comparison. map f xs = if empty xs then [] else f (head xs) : map f (tail xs) (I like pattern matching too.)
by abecedarius 11y ago
That wasn't quite a fair comparison.
map f xs =
if empty xs
then []
else f (head xs) : map f (tail xs)
(I like pattern matching too.)
- jarcane 11y agoThe point isn't to be a "fair" comparison, but rather to compare the number of explicit operations involved. I'd note that your Haskell example there is largely equivalent to the Scheme one.
- abecedarius 11y agoYes, it's equivalent on purpose. Yet in Haskell it's only a couple tokens longer than the pattern-matching original which you called "far more terse". To fairly test a claim, one should change only the variables the claim is about.