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

Éric Pailleau <>
Tue Oct 20 11:34:02 CEST 2015

Yes Erlang L -- O is slow compared to list partition, but can be used on short lists.
It was more a mathematical notation to say: what is not odd is even. List partition is quite better to achieve this.

Le 20 oct. 2015 6:04 AM, "Richard A. O'Keefe" <> a écrit :
> 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