Open lue-bird opened 3 months ago
I like these simplifications!
The List.reverse
one just makes a lot of sense in particular :+1:
There are however a few ones that I think we probably shouldn't do, and those are the ones where we end up repeat n
or f
or a
. While it looks good in small examples like these, these could be large expressions, and you end up with the code duplication (just like you mentioned for List.unzip
) which then makes maintenance potentially harder.
List.filterMap f (List.repeat n a)
It does look quite a big uglier yeah...
for
Array
:likely controversial
because if
n
is not simple, logic gets unnecessarily duplicated.because while it's technically simpler logic-wise and much more performant the resulting code looks ugly (to me).