<?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="2002/07/7a53453ae2b7b2f75c7a043007c1a129"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2002-07-12T07:24:32"
  subject="Re: [Caml-list] Functional scanning facilities"
  prev="2002/07/4646ea3840468a1a992752add8269c3d"
  next="2002/07/84beefd09e6c30d2e71117106e962bc4"
  prev-in-thread="2002/07/1cbfb9354e107fc23bcc20c58328417a"
  next-in-thread="2002/07/84beefd09e6c30d2e71117106e962bc4"
  prev-thread="2002/07/3998b4f8a6bcd42dfd813bab6ceab773"
  next-thread="2002/07/1fdaa5e902b0c73415d567249ed998ad"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Functional scanning facilities">
<msg 
  url="2002/07/4e07fd5ea13c7b76f164f1ee5265fa6c"
  from="Alessandro Baretta &lt;alex@b...&gt;"
  author="Alessandro Baretta"
  date="2002-07-12T01:29:27"
  subject="[Caml-list] Functional scanning facilities">
<msg 
  url="2002/07/1cbfb9354e107fc23bcc20c58328417a"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-12T02:37:21"
  subject="Re: [Caml-list] Functional scanning facilities">
<msg 
  url="2002/07/7a53453ae2b7b2f75c7a043007c1a129"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2002-07-12T07:24:32"
  subject="Re: [Caml-list] Functional scanning facilities">
<msg 
  url="2002/07/84beefd09e6c30d2e71117106e962bc4"
  from="John Prevost &lt;j.prevost@c...&gt;"
  author="John Prevost"
  date="2002-07-12T07:51:48"
  subject="Re: [Caml-list] Functional scanning facilities">
</msg>
<msg 
  url="2002/07/b2a8235171bbfd9f04d11d2c37e64130"
  from="Basile STARYNKEVITCH &lt;basile.starynkevitch@c...&gt;"
  author="Basile STARYNKEVITCH"
  date="2002-07-12T07:55:50"
  subject="Re: [Caml-list] Functional scanning facilities">
</msg>
<msg 
  url="2002/07/97e016810f98dca181ee792851b7e4c6"
  from="Stefano Zacchiroli &lt;zack@c...&gt;"
  author="Stefano Zacchiroli"
  date="2002-07-12T08:25:14"
  subject="Re: [Caml-list] Functional scanning facilities">
<msg 
  url="2002/07/95c6ab6137dadfa3a2ff8ef36c0f1d12"
  from="Pierre Weis &lt;pierre.weis@i...&gt;"
  author="Pierre Weis"
  date="2002-07-12T11:17:02"
  subject="Re: [Caml-list] Functional scanning facilities">
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
&gt; &gt;&gt;&gt;&gt;&gt; "ab" == Alessandro Baretta &lt;alex@baretta.com&gt; writes:
&gt; 
&gt;     ab&gt; How about something like the follwing--the idea coming from
&gt;     ab&gt; posts I read a while ago about CPS programming:
&gt; 
&gt; It works quite well.  Take a look at Lindig's O'Caml implementation of
&gt; parser combinators at http://www.gaertner.de/~lindig/software/mylib.html
&gt; 
&gt; A more complete description of how these work (expressed monadically)
&gt; is available in a paper by Hutton and Meijer at
&gt; http://www.cs.nott.ac.uk/~gmh/monparsing.pdf
&gt; 
&gt; These techniques can be applied quite easily in O'Caml, although the
&gt; way infix definitions work leads to some rather... interesting choices
&gt; of symbols.
&gt; 
&gt; John.
&gt; 
&gt; -------------------
&gt; To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
&gt; Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
&gt; Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

Em, sorry to interrupt you: I'm a fan of combinators since decades (my
thesis was entitled something like ``compiling with combinators''), I
also do love lambda-calculus and monades that I consider extremely
elegant and powerful theoretical tools, but wait, wait, wait ...

Here, we want to design and implement a practical, compact, simple to
understand, and easy way to print and scan in the context of a
functional language with full-fledged imperative features (we are not
in a lazy context where monades are mandatory anyway).

In this favourable situation, I'm afraid no combinatorial approach can
compete with the readability and compactness of C-style formats. In
addition, from the user's point of view, the seamingly flat
first-order typing simplicity of Caml printf (and now scanf)
primitives will be extremely hard to beat. Let alone the strongly
symetrical status and overall treatment of scanf and printf that is so
wonderful in the actual implementation of the Objective Caml
library.

Note that I am so enthousiastic about the new Scanf module because
this problem of implementing a C-like scanf facility in Caml was a
background thread in my head for at least 5 years, before I found the
tricks that lead to the actual scanf implementation ...

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

