Oh sorry I assumed `o' is short for `out' and `v' for `value', which seems not the case.

By the way, in your solution  `fst' and `snd' should be exchanged, i.e.

let a = List.map snd (List.filter (fun x -> fst x) [(out, o); (value, v)])


On 01/20/2012 05:08 PM, Valentin ROBERT 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 <mysnowls@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