Re: [Caml-list] is there a more concise way to write this?

2012-01-20 Thread Valentin ROBERT
Rather (in this case): let a = List.map fst (List.filter (fun x - snd x) [(out, o); (value, v)]) That seems reasonable. On Fri, Jan 20, 2012 at 09:52, Lin mysno...@163.com wrote: What about: let a = List.filter (fun x - x) [out; value] Lin On 01/20/2012 02:38 PM, Martin DeMello

Re: [Caml-list] is there a more concise way to write this?

2012-01-19 Thread Valentin ROBERT
I guess you can write it like: let a = (if out then [o] else []) @ (if value then [v] else []) But it's not particularly more pleasant to the eye. Still it reduces the exponential explosion of the code, at a small additional cost (the @), I believe. On Fri, Jan 20, 2012 at 07:38, Martin DeMello