Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Lin <mysnowls@163.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] is there a more concise way to write this?
Date: Fri, 20 Jan 2012 17:19:11 +0800	[thread overview]
Message-ID: <4F19318F.8010704@163.com> (raw)
In-Reply-To: <CAC1A9D5=1rCxyLVFb4Fv6MrxtuOjVQC_C-yQPgqAJ2FmkSWS-Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

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 
> <mailto: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
>
>


[-- Attachment #2: Type: text/html, Size: 3206 bytes --]

  reply	other threads:[~2012-01-20  9:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20  6:38 Martin DeMello
2012-01-20  6:46 ` Valentin ROBERT
2012-01-20  6:58   ` Martin DeMello
2012-01-20  8:37   ` David Allsopp
2012-01-20 13:29     ` Edgar Friendly
2012-01-20 13:50       ` Fabrice Le Fessant
2012-01-20 13:58       ` oliver
2012-01-20 14:05         ` Edgar Friendly
2012-01-20 14:12       ` David Allsopp
2012-01-20 14:23         ` Fabrice Le Fessant
2012-01-20 14:23         ` Edgar Friendly
2012-01-20  8:37   ` Sebastien Ferre
2012-01-20  9:11     ` Jerome Vouillon
2012-01-20  9:34       ` Fabrice Le Fessant
2012-01-20 10:27         ` Arnaud Spiwack
2012-01-20  8:52 ` Lin
2012-01-20  9:08   ` Valentin ROBERT
2012-01-20  9:19     ` Lin [this message]
2012-01-20 10:21     ` Martin DeMello
2012-01-20  9:38 ` oliver
2012-01-20 13:59   ` Edgar Friendly
2012-01-20 14:42     ` oliver
2012-01-20 15:31     ` Fabrice Le Fessant
2012-01-20 21:04     ` oliver
2012-01-20 21:09       ` oliver
2012-01-20 20:40 ` oliver
2012-01-20 21:07   ` Martin DeMello

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F19318F.8010704@163.com \
    --to=mysnowls@163.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox