caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@cs.uni-sb.de>
To: "Quôc Peyrot" <chojin@lrde.epita.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] right-associating infix application operator camlp4 extension
Date: Thu, 11 Aug 2005 12:41:40 +0200	[thread overview]
Message-ID: <33e9ca430f07c8e8c61bfabe70274b24@cs.uni-sb.de> (raw)
In-Reply-To: <07A35039-4D77-4F7B-B0CC-A0247FBA14D0@lrde.epita.fr>


On Aug 11, 2005, at 5:04 AM, Quôc Peyrot wrote:

> Thanks a lot for the answers.
> Strangely I couldn't find $ in this documentation, but
> let ($) f x = f x
> seems to work.

This does not work; you need a right associative operator:

# let ($) f x = f x;;
val ( $ ) : ('a -> 'b) -> 'a -> 'b = <fun>
# (-) 3 $ (/) 4 $ 2 ;;
This expression has type int -> int but is here used with type int

# let (@@) f x = f x;;
val ( @@ ) : ('a -> 'b) -> 'a -> 'b = <fun>
# (-) 3 @@ (/) 4 @@ 2 ;;
- : int = 1

This is the right result for 3-(4/2)=1.

-- Christian


      parent reply	other threads:[~2005-08-11 10:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-06 23:03 Quôc Peyrot
2005-08-07  8:23 ` [Caml-list] " Christian Lindig
2005-08-10  6:21 ` osiire
2005-08-10  7:38   ` Jean-Marie Gaillourdet
2005-08-10  7:50     ` David MENTRE
2005-08-11  3:04       ` Quôc Peyrot
2005-08-11  4:50         ` Stephane Glondu
2005-08-11 10:41         ` Christian Lindig [this message]

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=33e9ca430f07c8e8c61bfabe70274b24@cs.uni-sb.de \
    --to=lindig@cs.uni-sb.de \
    --cc=caml-list@inria.fr \
    --cc=chojin@lrde.epita.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;
as well as URLs for NNTP newsgroup(s).