<?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/ec338a887ac5c965576076298f0bdb53"
  from="padiolea@i..."
  author="padiolea@i..."
  date="2005-05-27T12:46:16"
  subject="Re: [Caml-list] infix functions"
  prev="2005/05/22765a7e8cfebbfa69bc0fc8128b8eee"
  next="2005/05/3405c44764e476f00f816b68d6cb19a6"
  prev-in-thread="2005/05/3911702a49feba6f0afb3ecbb9030cff"
  next-in-thread="2005/05/3405c44764e476f00f816b68d6cb19a6"
  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>
&gt; On Fri, May 27, 2005 at 10:06:10PM +1200, Jonathan Roewen wrote:
&gt;&gt; Hi,
&gt;&gt;
&gt;&gt; I see some pervasive functions are infix, and I'm wondering if there's
&gt;&gt; any plan to support making any arbitrary infix functions?
&gt;&gt;
&gt;&gt; For instance, the Int32 (etc) modules are horrible to use cause of the
&gt;&gt; prefix functions. These are perfect candidates for being infix. And
&gt;&gt; being an OS project,

Can we access the code of this OS project ?
I know that there is another OS project with caml called funk at
  http://perso.ens-lyon.fr/samuel.mimram/docs/funk_doc/
and another one called House but with haskell
 http://www.cse.ogi.edu/~hallgren/House/
that you might be interested in.

&gt; It's also possible to create infix functions; however you have to use
&gt; the camlp4 preprocessor and your functions become reserved words in
&gt; the language.  Here is an example of an infix function which should
&gt; get you started:
&gt;
&gt; 	open Pcaml
&gt;
&gt; 	EXTEND
&gt; 	   expr: AFTER "apply"
&gt; 	   [ LEFTA
&gt; 	       [ e1 = expr; "map_with"; e2 = expr -&gt;
&gt; 	           &lt;:expr&lt; List.map $e2$ $e1$ &gt;&gt;
&gt; 	       ]
&gt; 	   ];
&gt; 	END
&gt;
&gt; So using that extension you could write code like:
&gt;
&gt; 	list map_with (fun elem -&gt; ...)

I think it is simpler for such cases to have a generic operator such as
let (+&gt;) o f = f o

and then just do
 [1;2;3;4] +&gt; map (fun x -&gt; x+1)
which is reminescent of object notation.





</contents>

</message>

