<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2005/05/ecd76077d2f949effe289b3db4889044"
  from="Vincenzo Ciancia &lt;vincenzo_yahoo_addressguard-gmane@y...&gt;"
  author="Vincenzo Ciancia"
  date="2005-05-27T11:14:07"
  subject="Re: infix functions"
  prev="2005/05/a75422b52de2316685268a49e63d92b7"
  next="2005/05/22765a7e8cfebbfa69bc0fc8128b8eee"
  prev-in-thread="2005/05/a75422b52de2316685268a49e63d92b7"
  prev-thread="2005/05/71cd7e87cf18096774a9be24b165c5d0"
  next-thread="2005/05/0863ff06ae4cdb1a42c798a087362566"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] infix functions">
<msg 
  url="2005/05/b3e1a86c65afa1b9438f0c6828902fae"
  from="Jonathan Roewen &lt;jonathan.roewen@g...&gt;"
  author="Jonathan Roewen"
  date="2005-05-27T10:06:11"
  subject="[Caml-list] infix functions">
<msg 
  url="2005/05/3911702a49feba6f0afb3ecbb9030cff"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2005-05-27T10:54:29"
  subject="Re: [Caml-list] infix functions">
<msg 
  url="2005/05/ec338a887ac5c965576076298f0bdb53"
  from="padiolea@i..."
  author="padiolea@i..."
  date="2005-05-27T12:46:16"
  subject="Re: [Caml-list] infix functions">
<msg 
  url="2005/05/3405c44764e476f00f816b68d6cb19a6"
  from="William D. Neumann &lt;wneumann@c...&gt;"
  author="William D. Neumann"
  date="2005-05-27T14:20:06"
  subject="Re: [Caml-list] infix functions">
</msg>
</msg>
</msg>
<msg 
  url="2005/05/a75422b52de2316685268a49e63d92b7"
  from="Jean-Christophe Filliatre &lt;Jean-Christophe.Filliatre@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2005-05-27T11:12:56"
  subject="Re: [Caml-list] infix functions">
</msg>
<msg 
  url="2005/05/ecd76077d2f949effe289b3db4889044"
  from="Vincenzo Ciancia &lt;vincenzo_yahoo_addressguard-gmane@y...&gt;"
  author="Vincenzo Ciancia"
  date="2005-05-27T11:14:07"
  subject="Re: infix functions">
</msg>
</msg>
</thread>

<contents>
Jonathan Roewen wrote:

&gt; Hi,
&gt; 
&gt; I see some pervasive functions are infix, and I'm wondering if there's
&gt; any plan to support making any arbitrary infix functions?
&gt; 
&gt; For instance, the Int32 (etc) modules are horrible to use cause of the
&gt; prefix functions. These are perfect candidates for being infix.

Not arbitrary, but there are some "free" symbols that can be defined (I
don't know exactly how many and what, but I guess it's on the manual or in
the lexer :) ), and all the infix operators can be redefined. Example of
redefining "+":

########
# module InfixInt32 = struct
    let (+) = Int32.add
  end;;
module InfixInt32 : sig val ( + ) : int32 -&gt; int32 -&gt; int32 end
# 3+3;;
- : int = 6
# open InfixInt32;;
# 3+3;;
This expression has type int but is here used with type int32
#######

example of defining "+*"

#######
# let (+*) = Int32.add;;
val ( +* ) : int32 -&gt; int32 -&gt; int32 = &lt;fun&gt;
# 30l +* 20l;;
- : int32 = 50l
#######

I don't know if there is a way to force inlining of "+*" though, but I
suppose that you could finally resort to defining your operators in camlp4

http://pauillac.inria.fr/caml/camlp4/manual/manual006.html

see section 5.3.1

Bye

Vincenzo

-- 
Please note that I do not read the e-mail address used in the from field but
I read vincenzo_ml at yahoo dot it
Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo
vincenzo_ml at yahoo dot it


</contents>

</message>

