Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Till Varoquaux <till.varoquaux@gmail.com>
Cc: Keisuke Nakano <ksk@mist.i.u-tokyo.ac.jp>, caml-list@inria.fr
Subject: Re: [Caml-list] Simple idea for making a function infix
Date: Tue, 14 Nov 2006 04:58:35 +1100	[thread overview]
Message-ID: <1163440715.5452.12.camel@rosella.wigram> (raw)
In-Reply-To: <9d3ec8300611130819q7e13d5f4mb84b9fb1a2ac74ae@mail.gmail.com>

On Mon, 2006-11-13 at 17:19 +0100, Till Varoquaux wrote:
> Hi,
> 
> I don't really understand the point of the */ operator i your
> definition. It's fuy ecause I've cosiderig the same problem recetly ad
> came dow to this approach ( I'm redefining(@)... oe c )

> >    let ( /* ) x y = y x
> >    and ( */ ) x y = x y

The point is precedence: consider only /* then

	x /* f y

means

	x /* (f y)

whereas

	x /* f */ y

means

	(f x) y

Of course

	x /* f */ y z

means

	f x (y z)

but then 

	x + y z

also means

	(+) x (y z)


Also you can write

	x /* g h */ y

which means

	(g h) x y

which is kind of cute, eg:

	[] /* List.fold_left (fun x y -> y::x) */ [1;2;3]


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  parent reply	other threads:[~2006-11-13 17:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-13  7:23 Keisuke Nakano
2006-11-13 14:31 ` [Caml-list] " Chris King
2006-11-13 16:19 ` Till Varoquaux
2006-11-13 17:45   ` Jean-Christophe Filliatre
2006-11-13 17:58   ` skaller [this message]
2006-11-13 18:29     ` Till Varoquaux
2006-11-13 20:31       ` Karl Zilles
2006-11-13 21:06         ` Till Varoquaux

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=1163440715.5452.12.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=ksk@mist.i.u-tokyo.ac.jp \
    --cc=till.varoquaux@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