caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Serge Le Huitouze <serge.lehuitouze@gmail.com>
To: caml-list@yquem.inria.fr,
	Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Subject: Re: [Caml-list] Option functions (or lack thereof) + operator for composition
Date: Tue, 16 Nov 2010 14:52:59 +0100	[thread overview]
Message-ID: <AANLkTimoTq9Pev-xBDSQ+jKN86RnBDeV91t15anR-DAu@mail.gmail.com> (raw)
In-Reply-To: <97D1DAE6-9E21-4A87-87FC-72B3BCF2F071@gmail.com>

>> To get rid of many warnings, I wrapped some calls (the "connect" calls of
>> my widgets) into "ignore (f x y)" statements.
>
> You can, but unfortunately $ does not have the right associativity.
>
> # let ($) f x = f x;;
> val ( $ ) : ('a -> 'b) -> 'a -> 'b = <fun>
> # ignore $ 1+1;;
> - : unit = ()
> # succ $ succ 3;;
> - : int = 5
> # succ $ succ $ succ 3;;
>
> If you want the compositionality, you can use something starting with @:
>
> # let (@@) f x = f x;;
> val ( @@ ) : ('a -> 'b) -> 'a -> 'b = <fun>
> # succ @@ succ @@ succ 3;;
> - : int = 6
>

Wow, tricky!
Not as tricky as Perl naming scheme for variables, but still tricky! ;-)
So I have to learn the precedence and associaticity table in section 6.7 of
OCaml's reference manual!!!


> Note however that there is a simpler way to circumvent the problem:
> use the "-w s" option on the command line, disabling the statement warning.
> All my lablgtk code uses this flag :-)

Warnings should be gotten rid of, so I don't like the idea of making
them silent.
But restricting silence to the statement warning is probably OK.
And I'll take your words for it, since, obviously, you have more experience
with lablgtk than myself! ;-)

But, on the other hand, maybe you can harmlessly use "-w s", whereas it may
bite me, given my poor understanding of this stuff...


Thanks.

--Serge


  reply	other threads:[~2010-11-16 13:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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
     [not found] <1853021343.44703.1289906871683.JavaMail.root@zmbs4.inria.fr>
2010-11-16 11:43 ` Thomas Gazagnaire
2010-11-16 11:51   ` Gabriel Kerneis
2010-11-16 17:45     ` Martin Jambon

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=AANLkTimoTq9Pev-xBDSQ+jKN86RnBDeV91t15anR-DAu@mail.gmail.com \
    --to=serge.lehuitouze@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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;
as well as URLs for NNTP newsgroup(s).