<?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="2003/01/749cc246a902f0545aa1d76619448186"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2003-01-11T01:23:14"
  subject="Re: [Caml-list] camlp4: ONCE construct"
  prev="2003/01/5281362186fca4f0b07ae26e7e735b89"
  next="2003/01/b3381ea52ca855463acfe1b560847b5a"
  prev-in-thread="2003/01/5281362186fca4f0b07ae26e7e735b89"
  prev-thread="2003/01/9eafc8c29bd075f861777389ece4e829"
  next-thread="2003/01/5c5d8ca29ec6a960f9735772bd364443"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/1889606e7800e49e46e01c0a3d7cecd9"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2003-01-10T19:14:12"
  subject="[Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/5281362186fca4f0b07ae26e7e735b89"
  from="Yutaka OIWA &lt;oiwa@y...&gt;"
  author="Yutaka OIWA"
  date="2003-01-10T22:36:07"
  subject="Re: [Caml-list] camlp4: ONCE construct">
<msg 
  url="2003/01/749cc246a902f0545aa1d76619448186"
  from="jehenrik &lt;jehenrik@y...&gt;"
  author="jehenrik"
  date="2003-01-11T01:23:14"
  subject="Re: [Caml-list] camlp4: ONCE construct">
</msg>
</msg>
</msg>
</thread>

<contents>
&gt; See an article by Francois Pottier at
&gt; http://caml.inria.fr/archives/200107/msg00187.html
&gt; for (almost direct) answer.

Well, for my original question, consider the choice of regular 
expression compilation to be an arbitrary task.  The only point is that 
it be computationally expensive.  I have wanted the same thing in 
completely different contexts.


Jeff Henrikson


jehenrik&gt; Hi,
jehenrik&gt; I would like to write a Camlp4 construct which causes its 
argument to
jehenrik&gt; only be evaluated once.  Eg:

jehenrik&gt; ...
jehenrik&gt; 	...
jehenrik&gt; 		...
jehenrik&gt; 			ONCE Pcre.regexp "([0-9]+)"

jehenrik&gt; would be transformed to:

jehenrik&gt; let gensym000 = Pcre.regexp "([0-9]+)";;
jehenrik&gt; ...
jehenrik&gt; 	...
jehenrik&gt; 		...
jehenrik&gt; 			gensym000

-------------------
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>

