I ended up using

  let (>>?) x y = if x then [y] else [] in
  let a = (out   >>? ...) @
            (value >>? ...)

which had the advantage that it let me inline the definitions of o and
v while keeping things readable.

martin

On Fri, Jan 20, 2012 at 1:08 AM, Valentin ROBERT
<valentin.robert...@gmail.com> wrote:
> 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 wrote:
>>>
>>>       let a = match (out, value) with
>>>         (true, true)  ->  [o; v]
>>>       | (false, true) ->  [v]
>>>       | (true, false) ->  [o]
>>>       | (false, false) ->  []
>>>
>>
>>
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa-roc.inria.fr/wws/info/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to