From: Thomas Gazagnaire <thomas.gazagnaire@inria.fr>
To: Serge Le Huitouze <serge.lehuitouze@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Option functions (or lack thereof) + operator for composition
Date: Tue, 16 Nov 2010 12:43:30 +0100 [thread overview]
Message-ID: <1289907810.2954.148.camel@saorge.inria.fr> (raw)
In-Reply-To: <1853021343.44703.1289906871683.JavaMail.root@zmbs4.inria.fr>
Hi,
> I found it weird to be forced to use "match" expressions in my code
for
> doing that, e.g.:
> * let curSelectedRow = ref None in
> * let updateButtonsStatus () =
> * button_remove#misc#set_sensitive
> * (match !curSelectedRow with None -> false | _ -> true)
> * in
> * ...
>
You are not forced to use match expression, you can just define :
let is_none x = match x with None -> true | Some _ -> false
and is_some x = not (is_none x)
and then use these functions in your code ...
> In Haskell, I would write "ignore $ f x y", which I find much lighter
weight.
Just define:
let ($) f x = f x
and that should do the trick
Thomas
next parent reply other threads:[~2010-11-16 11:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1853021343.44703.1289906871683.JavaMail.root@zmbs4.inria.fr>
2010-11-16 11:43 ` Thomas Gazagnaire [this message]
2010-11-16 11:51 ` Gabriel Kerneis
2010-11-16 17:45 ` Martin Jambon
2010-11-16 11:27 Serge Le Huitouze
2010-11-16 11:49 ` [Caml-list] " David Allsopp
2010-11-16 14:23 ` Michael Ekstrand
2010-11-16 13:30 ` Jacques Garrigue
2010-11-16 13:52 ` Serge Le Huitouze
2010-11-16 14:19 ` dmitry grebeniuk
2010-11-16 14:26 ` Michael Ekstrand
2010-11-16 15:18 ` bluestorm
2010-11-16 15:26 ` bluestorm
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=1289907810.2954.148.camel@saorge.inria.fr \
--to=thomas.gazagnaire@inria.fr \
--cc=caml-list@yquem.inria.fr \
--cc=serge.lehuitouze@gmail.com \
/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