[erlang-questions] Can I do the same with a fold easily

Richard A. O'Keefe <>
Tue Oct 20 06:04:36 CEST 2015


On 20/10/2015, at 9:53 am, Éric Pailleau <> wrote:

> Hi,
> I agree but like Joe says: let it work,  then optimize if needed. 
> My main remark was: Splitting odd and even does not need to check odd then even, but check it is odd Else it is even (or contrary).

We agree on the Joe advice.
But to me, using L -- O is obfuscation.  It would be *harder* for
me to understand that code than say a version using
lists:partition/2.

No, let's be honest here.
It *WAS* quite a bit harder for me to understand the L -- O
version because I had to stop, check the documentation, try
a couple of tests, all to verify that the results came out in
the right order.

I quite agree that sometimes a bit of brute force *can* help you
get to working code quicker.  But it has to be *obviously correct*
brute force.



More information about the erlang-questions mailing list