* Immediate recursive functions @ 2005-02-17 15:32 Alex Baretta 2005-02-17 18:20 ` [Caml-list] " Marcin 'Qrczak' Kowalczyk ` (2 more replies) 0 siblings, 3 replies; 32+ messages in thread From: Alex Baretta @ 2005-02-17 15:32 UTC (permalink / raw) To: Ocaml I sometimes feel the need for a mu operator. I'm thinking of something like the following: # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 - : int = 120 as opposed to (let rec f x = if x <= 0 then 1 else x * (f (pred x)) in f) 5 - : int = 120 This is not really a feature wish so much a bit of insane curiosity. Is there any specific reason for not having this in the core language syntax? Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Immediate recursive functions 2005-02-17 15:32 Immediate recursive functions Alex Baretta @ 2005-02-17 18:20 ` Marcin 'Qrczak' Kowalczyk 2005-02-17 19:00 ` Jason Hickey 2005-02-17 19:18 ` Christian Szegedy 2 siblings, 0 replies; 32+ messages in thread From: Marcin 'Qrczak' Kowalczyk @ 2005-02-17 18:20 UTC (permalink / raw) To: caml-list Alex Baretta <alex@barettadeit.com> writes: > I sometimes feel the need for a mu operator. I'm thinking of something > like the following: > > # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 > - : int = 120 > > as opposed to > > (let rec f x = if x <= 0 then 1 else x * (f (pred x)) in f) 5 > - : int = 120 Here it is immediately applied to arguments. For such cases my language Kogut provides a syntax: loop 5 [ x {if (x <= 0) {1} else {x * again (x - 1)}} ] or with pattern matching: loop 5 [ (<= 0) {1} x {x * again (x - 1)} ] This is related to 'case' (OCaml's 'match') like in Scheme "named let" is related to ordinary 'let', except that the name 'again' is implicit. There can be more arguments than one. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Immediate recursive functions 2005-02-17 15:32 Immediate recursive functions Alex Baretta 2005-02-17 18:20 ` [Caml-list] " Marcin 'Qrczak' Kowalczyk @ 2005-02-17 19:00 ` Jason Hickey 2005-02-17 20:33 ` Alex Baretta 2005-02-17 19:18 ` Christian Szegedy 2 siblings, 1 reply; 32+ messages in thread From: Jason Hickey @ 2005-02-17 19:00 UTC (permalink / raw) To: Alex Baretta; +Cc: caml-list Alex Baretta wrote: > I sometimes feel the need for a mu operator. I'm thinking of something > like the following: > > # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 > - : int = 120 ... > This is not really a feature wish so much a bit of insane curiosity. Is > there any specific reason for not having this in the core language syntax? I can't give any arguments why your specific syntax is not allowed. In principle it isn't necessary, since a general fixpoint can be defined. # let rec fix f x = f (fix f) x;; val fix : (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b = <fun> # fix (fun f i -> if i = 0 then 1 else i * f (i - 1)) 10;; - : int = 3628800 # fix (fun f i j -> if i = 0 then 1 else j * f (i - 1) j) 10 5;; - : int = 9765625 The drawback is that (fix f x) is likely to be a bit more expensive to evaluate than the let-rec version. Jason -- Jason Hickey http://www.cs.caltech.edu/~jyh Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257 ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Immediate recursive functions 2005-02-17 19:00 ` Jason Hickey @ 2005-02-17 20:33 ` Alex Baretta 0 siblings, 0 replies; 32+ messages in thread From: Alex Baretta @ 2005-02-17 20:33 UTC (permalink / raw) To: Jason Hickey; +Cc: caml-list Jason Hickey wrote: > Alex Baretta wrote: > >> I sometimes feel the need for a mu operator. I'm thinking of something >> like the following: .. > > I can't give any arguments why your specific syntax is not allowed. In > principle it isn't necessary, since a general fixpoint can be defined. Why, of course it isn't needed! Neither is let rec needed for that matter once you have the fun construct. Y-combinators are all around you ... Of course, a large number of language features are just syntactic sugar which boils down to lambda abstractions and beta reductions. Explicit recursion is one of these. What I'm asking for is why the language does not provide the sugar for the mu recursive expressions. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Immediate recursive functions 2005-02-17 15:32 Immediate recursive functions Alex Baretta 2005-02-17 18:20 ` [Caml-list] " Marcin 'Qrczak' Kowalczyk 2005-02-17 19:00 ` Jason Hickey @ 2005-02-17 19:18 ` Christian Szegedy 2005-02-17 20:36 ` Alex Baretta 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon 2 siblings, 2 replies; 32+ messages in thread From: Christian Szegedy @ 2005-02-17 19:18 UTC (permalink / raw) To: Ocaml Alex Baretta wrote: > I sometimes feel the need for a mu operator. I'm thinking of something > like the following: > > # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 > - : int = 120 > > as opposed to > > (let rec f x = if x <= 0 then 1 else x * (f (pred x)) in f) 5 > - : int = 120 Feel free to write your CamlP4 extension ;) ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Immediate recursive functions 2005-02-17 19:18 ` Christian Szegedy @ 2005-02-17 20:36 ` Alex Baretta 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon 1 sibling, 0 replies; 32+ messages in thread From: Alex Baretta @ 2005-02-17 20:36 UTC (permalink / raw) To: Ocaml Christian Szegedy wrote: > Alex Baretta wrote: > >> I sometimes feel the need for a mu operator. I'm thinking of something >> like the following: >> >> # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 >> - : int = 120 >> >> as opposed to >> >> (let rec f x = if x <= 0 then 1 else x * (f (pred x)) in f) 5 >> - : int = 120 > > > Feel free to write your CamlP4 extension ;) I have had a short love story with Camlp4, but I find it's syntax far too wild to be worth learning. Hence, I abandoned camlp4 except for its ocpp incarnation with its quotation expansion support. I have written a short patch to parsing/parser.mly to support my syntax, but I am unable to get anything sensible out of it. I'll look more into this problem and post the patch if I manage to figure things out. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 19:18 ` Christian Szegedy 2005-02-17 20:36 ` Alex Baretta @ 2005-02-17 22:39 ` Martin Jambon 2005-02-17 23:30 ` [Caml-list] " Richard Jones ` (5 more replies) 1 sibling, 6 replies; 32+ messages in thread From: Martin Jambon @ 2005-02-17 22:39 UTC (permalink / raw) To: Christian Szegedy; +Cc: Ocaml On Thu, 17 Feb 2005, Christian Szegedy wrote: > Feel free to write your CamlP4 extension ;) :-) But there are few things to know/discover before starting. Is anyone interested in a kind of highly practical tutorial on how to extend the syntax of OCaml with Camlp4? I could possibly start writing one if there is enough demand. Martin -- Martin Jambon, PhD Researcher in Structural Bioinformatics since the 20th Century The Burnham Institute http://www.burnham.org San Diego, California ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon @ 2005-02-17 23:30 ` Richard Jones 2005-02-17 23:51 ` Michael Walter 2005-02-18 0:51 ` Micha ` (4 subsequent siblings) 5 siblings, 1 reply; 32+ messages in thread From: Richard Jones @ 2005-02-17 23:30 UTC (permalink / raw) To: Martin Jambon; +Cc: Ocaml On Thu, Feb 17, 2005 at 02:39:12PM -0800, Martin Jambon wrote: > But there are few things to know/discover before starting. > > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? > I could possibly start writing one if there is enough demand. Definitely! Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 23:30 ` [Caml-list] " Richard Jones @ 2005-02-17 23:51 ` Michael Walter 0 siblings, 0 replies; 32+ messages in thread From: Michael Walter @ 2005-02-17 23:51 UTC (permalink / raw) To: Richard Jones; +Cc: Martin Jambon, Ocaml Yes! :) On Thu, 17 Feb 2005 23:30:20 +0000, Richard Jones <rich@annexia.org> wrote: > On Thu, Feb 17, 2005 at 02:39:12PM -0800, Martin Jambon wrote: > > But there are few things to know/discover before starting. > > > > Is anyone interested in a kind of highly practical tutorial on > > how to extend the syntax of OCaml with Camlp4? > > I could possibly start writing one if there is enough demand. > > Definitely! > > Rich. > > -- > Richard Jones, CTO Merjis Ltd. > Merjis - web marketing and technology - http://merjis.com > Team Notepad - intranets and extranets for business - http://team-notepad.com > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon 2005-02-17 23:30 ` [Caml-list] " Richard Jones @ 2005-02-18 0:51 ` Micha 2005-02-18 3:37 ` briand 2005-02-18 5:21 ` Oliver Bandel ` (3 subsequent siblings) 5 siblings, 1 reply; 32+ messages in thread From: Micha @ 2005-02-18 0:51 UTC (permalink / raw) To: caml-list Am Donnerstag, 17. Februar 2005 23:39 schrieb Martin Jambon: > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? > I could possibly start writing one if there is enough demand. yes :-) Michael ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-18 0:51 ` Micha @ 2005-02-18 3:37 ` briand 0 siblings, 0 replies; 32+ messages in thread From: briand @ 2005-02-18 3:37 UTC (permalink / raw) To: Micha; +Cc: caml-list I would also be interested. brian ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon 2005-02-17 23:30 ` [Caml-list] " Richard Jones 2005-02-18 0:51 ` Micha @ 2005-02-18 5:21 ` Oliver Bandel 2005-02-18 6:51 ` Johann Spies ` (2 subsequent siblings) 5 siblings, 0 replies; 32+ messages in thread From: Oliver Bandel @ 2005-02-18 5:21 UTC (permalink / raw) To: caml-list On Thu, Feb 17, 2005 at 02:39:12PM -0800, Martin Jambon wrote: > On Thu, 17 Feb 2005, Christian Szegedy wrote: > > > Feel free to write your CamlP4 extension ;) > > :-) > But there are few things to know/discover before starting. > > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? absolutely, there is.... I neglected Camlp4 because of the uncomprehensible documentation on it. > I could possibly start writing one if there is enough demand. DEMAND! DEMAND! DEMAND! DEMAND! Regards, Oliver ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon ` (2 preceding siblings ...) 2005-02-18 5:21 ` Oliver Bandel @ 2005-02-18 6:51 ` Johann Spies 2005-02-18 8:04 ` [Caml-list] Camlp4 documentation Alex Baretta 2005-02-18 8:14 ` [Caml-list] Camlp4 documentation (was: Immediate recursive functions) Robert M. Solovay 5 siblings, 0 replies; 32+ messages in thread From: Johann Spies @ 2005-02-18 6:51 UTC (permalink / raw) To: caml-list, Ocaml On Thu, Feb 17, 2005 at 02:39:12PM -0800, Martin Jambon wrote: > On Thu, 17 Feb 2005, Christian Szegedy wrote: > > > Feel free to write your CamlP4 extension ;) > > :-) > But there are few things to know/discover before starting. > > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? Yes, please. Regards Johann -- Johann Spies Telefoon: 021-808 4036 Informasietegnologie, Universiteit van Stellenbosch "All we like sheep have gone astray; we have turned every one to his own way; and the LORD hath laid on him the iniquity of us all." Isaiah 53:6 ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon ` (3 preceding siblings ...) 2005-02-18 6:51 ` Johann Spies @ 2005-02-18 8:04 ` Alex Baretta 2005-02-18 8:54 ` Alex Cowie 2005-02-18 8:14 ` [Caml-list] Camlp4 documentation (was: Immediate recursive functions) Robert M. Solovay 5 siblings, 1 reply; 32+ messages in thread From: Alex Baretta @ 2005-02-18 8:04 UTC (permalink / raw) To: Ocaml Martin Jambon wrote: > On Thu, 17 Feb 2005, Christian Szegedy wrote: > > >>Feel free to write your CamlP4 extension ;) > > > :-) > But there are few things to know/discover before starting. > > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? > I could possibly start writing one if there is enough demand. > > > Martin > Why yes! Yet, it's terribly sad that DdR chose to forcibly impose upon the Camlp4 metaprogrammer to use the revised syntax. This is probably the main obstacle, together with the relative lack of documentation, to the diffusion of Camlp4, IMHO. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation 2005-02-18 8:04 ` [Caml-list] Camlp4 documentation Alex Baretta @ 2005-02-18 8:54 ` Alex Cowie 2005-02-18 16:20 ` Camlp4 with traditional syntax (was: Camlp4 documentation) Hendrik Tews 0 siblings, 1 reply; 32+ messages in thread From: Alex Cowie @ 2005-02-18 8:54 UTC (permalink / raw) To: Ocaml Alex Baretta wrote: > Martin Jambon wrote: > >> On Thu, 17 Feb 2005, Christian Szegedy wrote: >> >> >>> Feel free to write your CamlP4 extension ;) >> >> >> >> :-) >> But there are few things to know/discover before starting. >> >> Is anyone interested in a kind of highly practical tutorial on >> how to extend the syntax of OCaml with Camlp4? >> I could possibly start writing one if there is enough demand. >> >> >> Martin >> > > Why yes! Yet, it's terribly sad that DdR chose to forcibly impose upon > the Camlp4 metaprogrammer to use the revised syntax. This is probably > the main obstacle, together with the relative lack of documentation, > to the diffusion of Camlp4, IMHO. > > Alex > For me, the use of revised syntax has been a disincentive to using Camlp4 metaprogramming. I have always wondered whether a traditional syntax version of Camlp4 was technically feasible. Any comments? Alex Cowie -- School of Computer and Information Science University of South Australia ^ permalink raw reply [flat|nested] 32+ messages in thread
* Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 8:54 ` Alex Cowie @ 2005-02-18 16:20 ` Hendrik Tews 2005-02-18 16:28 ` [Caml-list] " Alex Baretta ` (2 more replies) 0 siblings, 3 replies; 32+ messages in thread From: Hendrik Tews @ 2005-02-18 16:20 UTC (permalink / raw) To: Ocaml Alex Cowie <cowie@cs.unisa.edu.au> writes: For me, the use of revised syntax has been a disincentive to using Camlp4 metaprogramming. I have always wondered whether a traditional syntax version of Camlp4 was technically feasible. Any comments? I believe it is possible. You can parse traditional ocaml (as opposed to the revised syntax) with camlp4, so it should be possible to write a quotation expander using traditional ocaml. I remember Daniel de Rauglaudre complaint a few times about the difficulty of parsing ocaml. So a quotation expander using traditional ocaml might have dark corners which do not look as elegant as pa_macro.ml. A alternative quotation expander using traditional ocaml would be much simpler to set up than the original one in camlp4/meta/q_MLast, because you don't have to deal with bootstrapping issues. The alternative expander would be written in the revised syntax and compiled when camlp4 has been built. Moreover, all the necessary pieces are already contained in the camlp4 sources: the quotation expander is in q_MLast and the traditional ocaml syntax is in etc/pa_o.ml. So you would only mix the two files, taking the grammer from pa_o and the actions from q_MLast. I even started once, but did not continue. If anybody starts to work on an alternative quotation expander using traditional ocaml, please announce. Bye, Hendrik Tews ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 16:20 ` Camlp4 with traditional syntax (was: Camlp4 documentation) Hendrik Tews @ 2005-02-18 16:28 ` Alex Baretta 2005-02-18 22:36 ` Hendrik Tews 2005-02-18 18:43 ` [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) Martin Jambon 2005-02-22 10:29 ` Oliver Bandel 2 siblings, 1 reply; 32+ messages in thread From: Alex Baretta @ 2005-02-18 16:28 UTC (permalink / raw) To: Ocaml Hendrik Tews wrote: > Alex Cowie <cowie@cs.unisa.edu.au> writes: > > For me, the use of revised syntax has been a disincentive to using > Camlp4 metaprogramming. I have always wondered whether a traditional > syntax version of Camlp4 was technically feasible. Any comments? > > I believe it is possible. You can parse traditional ocaml (as > opposed to the revised syntax) with camlp4, so it should be > possible to write a quotation expander using traditional ocaml. I > remember Daniel de Rauglaudre complaint a few times about the > difficulty of parsing ocaml. So a quotation expander using > traditional ocaml might have dark corners which do not look as > elegant as pa_macro.ml. There is one more issue with Camlp4: it does not allow for quotations to expand to generic syntactic elements. Often, I use quotations which expand to module definitions. I had to implement my own quotation expander, bypassing the limitations of Camlp4 to achieve this. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 16:28 ` [Caml-list] " Alex Baretta @ 2005-02-18 22:36 ` Hendrik Tews 2005-02-21 12:28 ` Alex Baretta 0 siblings, 1 reply; 32+ messages in thread From: Hendrik Tews @ 2005-02-18 22:36 UTC (permalink / raw) To: Ocaml Alex Baretta <alex@barettadeit.com> writes: There is one more issue with Camlp4: it does not allow for quotations to expand to generic syntactic elements. Often, I use quotations which expand to module definitions. I had to implement my own quotation expander, bypassing the limitations of Camlp4 to achieve this. I don't quite understand, what's wrong with let me = <:module_expr< struct $ list of module def's $ end >> in <:str_item< module $some_name$ = $me$ >> ?? Bye, Hendrik ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 22:36 ` Hendrik Tews @ 2005-02-21 12:28 ` Alex Baretta 2005-02-21 12:55 ` Bardur Arantsson 0 siblings, 1 reply; 32+ messages in thread From: Alex Baretta @ 2005-02-21 12:28 UTC (permalink / raw) To: Hendrik Tews; +Cc: Ocaml Hendrik Tews wrote: > Alex Baretta <alex@barettadeit.com> writes: > > There is one more issue with Camlp4: it does not allow for quotations > to expand to generic syntactic elements. Often, I use quotations which > expand to module definitions. I had to implement my own quotation > expander, bypassing the limitations of Camlp4 to achieve this. > > I don't quite understand, what's wrong with > > let me = <:module_expr< struct $ list of module def's $ end >> > in > <:str_item< module $some_name$ = $me$ >> We use quotation expanders to embed completely different languages, such as SQL, within Ocaml code. Specifically, the SQL quotation expander compiles SQL code to an Ocaml module. CamlP4 signals an error because quotations are only meant to be used as expressions or as patterns, IIRC. Anyhow, the solution is either to use ocpp rather than camlp4 as a preprocessor (ocpp is less picky), or to write one's own quotation preprocessor. We use both techniques depending on the context. Alex -- ********************************************************************* http://www.barettadeit.com/ Baretta DE&IT A division of Baretta SRL tel. +39 02 370 111 55 fax. +39 02 370 111 54 Our technology: The Application System/Xcaml (AS/Xcaml) <http://www.asxcaml.org/> The FreerP Project <http://www.freerp.org/> ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-21 12:28 ` Alex Baretta @ 2005-02-21 12:55 ` Bardur Arantsson 2005-02-21 15:22 ` [Caml-list] Camlp4 with traditional syntax Olivier Andrieu 0 siblings, 1 reply; 32+ messages in thread From: Bardur Arantsson @ 2005-02-21 12:55 UTC (permalink / raw) To: caml-list On Mon, Feb 21, 2005 at 01:28:25PM +0100, Alex Baretta wrote: > Hendrik Tews wrote: > >Alex Baretta <alex@barettadeit.com> writes: > > There is one more issue with Camlp4: it does not allow for quotations > > to expand to generic syntactic elements. Often, I use quotations which > > expand to module definitions. I had to implement my own quotation > > expander, bypassing the limitations of Camlp4 to achieve this. > >I don't quite understand, what's wrong with > >let me = <:module_expr< struct $ list of module def's $ end >> > >in > > <:str_item< module $some_name$ = $me$ >> > We use quotation expanders to embed completely different languages, such > as SQL, within Ocaml code. Specifically, the SQL quotation expander > compiles SQL code to an Ocaml module. CamlP4 signals an error because > quotations are only meant to be used as expressions or as patterns, > IIRC. IIRC quotations can expand to arbitrary ASTs. Only the point of *use* (ie. substitution) determines which types of ASTs will be accepted. Of course, if you're generating things like module interfaces and implementations, you'll need to generate them side by side since there is no "combined module interface+implementation" AST node type. -- Bardur Arantsson <bardur@imada.sdu.dk> <bardur@scientician.net> Intolerant people should be shot. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax 2005-02-21 12:55 ` Bardur Arantsson @ 2005-02-21 15:22 ` Olivier Andrieu 2005-02-21 16:57 ` Bardur Arantsson 0 siblings, 1 reply; 32+ messages in thread From: Olivier Andrieu @ 2005-02-21 15:22 UTC (permalink / raw) To: list-caml-list; +Cc: caml-list > Bardur Arantsson [Mon, 21 Feb 2005]: > On Mon, Feb 21, 2005 at 01:28:25PM +0100, Alex Baretta wrote: > > > Hendrik Tews wrote: > > >Alex Baretta <alex@barettadeit.com> writes: > > > > There is one more issue with Camlp4: it does not allow for quotations > > > to expand to generic syntactic elements. Often, I use quotations which > > > expand to module definitions. I had to implement my own quotation > > > expander, bypassing the limitations of Camlp4 to achieve this. > > > >I don't quite understand, what's wrong with > > > >let me = <:module_expr< struct $ list of module def's $ end >> > > >in > > > <:str_item< module $some_name$ = $me$ >> > > > We use quotation expanders to embed completely different > > languages, such as SQL, within Ocaml code. Specifically, the SQL > > quotation expander compiles SQL code to an Ocaml module. CamlP4 > > signals an error because quotations are only meant to be used as > > expressions or as patterns, IIRC. > > IIRC quotations can expand to arbitrary ASTs. Only the point of > *use* (ie. substitution) determines which types of ASTs will be > accepted. No, quotations can expand to only expressions or patterns. See the type of a quotation expander in quotation.mli : type expander = | ExStr of (bool -> string -> string) | ExAst of ((string -> MLast.expr) * (string -> MLast.patt)) As Alex mentionned, ocpp expands quotations everywhere (but only deals with string-expanding quotations, not the AST ones), so it can be used to generate structure items (module elements). > Of course, if you're generating things like module interfaces and > implementations, you'll need to generate them side by side since > there is no "combined module interface+implementation" AST node > type. The camlp4 AST does have this kind of nodes, as Martin mentionned. You can use : # fun a b -> <:str_item< declare $a$ ; $b$ ; end >> ;; - : MLast.str_item -> MLast.str_item -> MLast.str_item = <fun> or : # fun l -> <:str_item< declare $list:l$ end >> ;; - : MLast.str_item list -> MLast.str_item = <fun> -- Olivier ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax 2005-02-21 15:22 ` [Caml-list] Camlp4 with traditional syntax Olivier Andrieu @ 2005-02-21 16:57 ` Bardur Arantsson 0 siblings, 0 replies; 32+ messages in thread From: Bardur Arantsson @ 2005-02-21 16:57 UTC (permalink / raw) To: caml-list On Mon, Feb 21, 2005 at 04:22:24PM +0100, Olivier Andrieu wrote: > > Bardur Arantsson [Mon, 21 Feb 2005]: > > On Mon, Feb 21, 2005 at 01:28:25PM +0100, Alex Baretta wrote: > > > Hendrik Tews wrote: > > > >Alex Baretta <alex@barettadeit.com> writes: > > > > There is one more issue with Camlp4: it does not allow for quotations > > > > to expand to generic syntactic elements. Often, I use quotations which > > > > expand to module definitions. I had to implement my own quotation > > > > expander, bypassing the limitations of Camlp4 to achieve this. > > > >I don't quite understand, what's wrong with > > > >let me = <:module_expr< struct $ list of module def's $ end >> > > > >in > > > > <:str_item< module $some_name$ = $me$ >> > > > We use quotation expanders to embed completely different > > > languages, such as SQL, within Ocaml code. Specifically, the SQL > > > quotation expander compiles SQL code to an Ocaml module. CamlP4 > > > signals an error because quotations are only meant to be used as > > > expressions or as patterns, IIRC. > > IIRC quotations can expand to arbitrary ASTs. Only the point of > > *use* (ie. substitution) determines which types of ASTs will be > > accepted. > No, quotations can expand to only expressions or patterns. See the > type of a quotation expander in quotation.mli : > type expander = > | ExStr of (bool -> string -> string) > | ExAst of ((string -> MLast.expr) * (string -> MLast.patt)) > As Alex mentionned, ocpp expands quotations everywhere (but only deals > with string-expanding quotations, not the AST ones), so it can be used > to generate structure items (module elements). You're right. I got confused by the distinction between user-defined and pre-defined quotation expanders. > > Of course, if you're generating things like module interfaces and > > implementations, you'll need to generate them side by side since > > there is no "combined module interface+implementation" AST node > > type. > The camlp4 AST does have this kind of nodes, as Martin mentionned. > You can use : > # fun a b -> <:str_item< declare $a$ ; $b$ ; end >> ;; > - : MLast.str_item -> MLast.str_item -> MLast.str_item = <fun> > or : > # fun l -> <:str_item< declare $list:l$ end >> ;; > - : MLast.str_item list -> MLast.str_item = <fun> Uh, yes, you use <str_item:<...> to generate module implementations, but when I looked last you couldn't use MLast.sig_item and MLast.str_item interchangably, so for instance, you couldn't ask pr_(o|r) to pretty-print a str_item as a module interface. Instead you had to also generate a sig_item and pretty-print that. (For good reason, you don't necessarily want to have everything inside the module visible from the outside...). That's all I was referring to by generating them "side by side". -- Bardur Arantsson <bardur@imada.sdu.dk> <bardur@scientician.net> - It might look like I'm standing motionless, but I'm actively waiting for my problems to go away. Scott Adams ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 16:20 ` Camlp4 with traditional syntax (was: Camlp4 documentation) Hendrik Tews 2005-02-18 16:28 ` [Caml-list] " Alex Baretta @ 2005-02-18 18:43 ` Martin Jambon 2005-02-18 22:41 ` Hendrik Tews 2005-02-22 10:29 ` Oliver Bandel 2 siblings, 1 reply; 32+ messages in thread From: Martin Jambon @ 2005-02-18 18:43 UTC (permalink / raw) To: Hendrik Tews; +Cc: Ocaml On 18 Feb 2005, Hendrik Tews wrote: > Alex Cowie <cowie@cs.unisa.edu.au> writes: > > For me, the use of revised syntax has been a disincentive to using > Camlp4 metaprogramming. I have always wondered whether a traditional > syntax version of Camlp4 was technically feasible. Any comments? > > I believe it is possible. You can parse traditional ocaml (as > opposed to the revised syntax) with camlp4, so it should be > possible to write a quotation expander using traditional ocaml. I > remember Daniel de Rauglaudre complaint a few times about the > difficulty of parsing ocaml. So a quotation expander using > traditional ocaml might have dark corners which do not look as > elegant as pa_macro.ml. There is (at least) one construct which is not provided by the regular syntax (because it is totally useless when writing code by hand) but which is essential: declare <list of str_items> end This just packs several definitions (str_items) as one single str_item. This is extremely useful when replacing one definition written in an extended syntax by several successive definitions (or zero) written in OCaml. Martin -- Martin Jambon, PhD Researcher in Structural Bioinformatics since the 20th Century The Burnham Institute http://www.burnham.org San Diego, California ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 18:43 ` [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) Martin Jambon @ 2005-02-18 22:41 ` Hendrik Tews 0 siblings, 0 replies; 32+ messages in thread From: Hendrik Tews @ 2005-02-18 22:41 UTC (permalink / raw) To: Ocaml Martin Jambon <martin_jambon@emailuser.net> writes: There is (at least) one construct which is not provided by the regular syntax (because it is totally useless when writing code by hand) but which is essential: declare <list of str_items> end Right, the ocaml in the alternative quotation expander would have to get enriched with some pieces of the revised syntax. But that is easy to implement. Bye, Hendrik ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-18 16:20 ` Camlp4 with traditional syntax (was: Camlp4 documentation) Hendrik Tews 2005-02-18 16:28 ` [Caml-list] " Alex Baretta 2005-02-18 18:43 ` [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) Martin Jambon @ 2005-02-22 10:29 ` Oliver Bandel 2005-02-22 23:32 ` Richard Jones 2005-02-23 0:01 ` Martin Jambon 2 siblings, 2 replies; 32+ messages in thread From: Oliver Bandel @ 2005-02-22 10:29 UTC (permalink / raw) To: caml-list On Fri, Feb 18, 2005 at 05:20:34PM +0100, Hendrik Tews wrote: > Alex Cowie <cowie@cs.unisa.edu.au> writes: > > For me, the use of revised syntax has been a disincentive to using > Camlp4 metaprogramming. I have always wondered whether a traditional > syntax version of Camlp4 was technically feasible. Any comments? > > I believe it is possible. You can parse traditional ocaml (as > opposed to the revised syntax) with camlp4, so it should be > possible to write a quotation expander using traditional ocaml. I > remember Daniel de Rauglaudre complaint a few times about the > difficulty of parsing ocaml. So a quotation expander using > traditional ocaml might have dark corners which do not look as > elegant as pa_macro.ml. [...] Because I don't know about what you all are talking here, I hope that the intended Camlp4-Tutorial will explain such things in more detail. Not another "we know nearly all, and explain some nifty details, that you also can see, when looking into the sources and study them some months/years" documentation, please... :-> So, if the indended doc on Camlp4 would explain in detail what it is good for, what it provides and how to use it, I (and IMHO many others) would gain a lot of such a documentation/tutorial. Explaining the details to pwople who already knew the most stuff, IMHO is not really needed. This can be done in discussions on the list (or when people know the tools, they really can look into the sources, because they know something about what they are intended to do). Hoping for a good intruductional tutorial... Regards, Oliver ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-22 10:29 ` Oliver Bandel @ 2005-02-22 23:32 ` Richard Jones 2005-02-23 0:01 ` Martin Jambon 1 sibling, 0 replies; 32+ messages in thread From: Richard Jones @ 2005-02-22 23:32 UTC (permalink / raw) To: Oliver Bandel; +Cc: caml-list On Tue, Feb 22, 2005 at 11:29:00AM +0100, Oliver Bandel wrote: > So, if the indended doc on Camlp4 would > explain in detail what it is good for, what it > provides and how to use it, I (and IMHO many others) > would gain a lot of such a documentation/tutorial. I too am eagerly awaiting a good tutorial on Camlp4. I've done a few things using Camlp4, and for me the syntax seems to be needlessly obscure. For example, here's how to write an infix 'map_with' operator, the syntax being: 'list map_with f' which is equivalent to 'List.map f list': open Pcaml EXTEND expr: AFTER "apply" [ LEFTA [ e1 = expr; "map_with"; e2 = expr -> <:expr< List.map $e2$ $e1$ >> ] ]; END Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-22 10:29 ` Oliver Bandel 2005-02-22 23:32 ` Richard Jones @ 2005-02-23 0:01 ` Martin Jambon 2005-02-24 0:47 ` Oliver Bandel 1 sibling, 1 reply; 32+ messages in thread From: Martin Jambon @ 2005-02-23 0:01 UTC (permalink / raw) To: Oliver Bandel; +Cc: caml-list On Tue, 22 Feb 2005, Oliver Bandel wrote: [...] > Because I don't know about what you all are talking here, > I hope that the intended Camlp4-Tutorial will explain > such things in more detail. I started writing a tutorial this weekend. There are many things to say, and there are also many things that I ignore... > Not another "we know nearly all, and explain some nifty > details, that you also can see, when looking into the sources > and study them some months/years" documentation, please... :-> > > So, if the indended doc on Camlp4 would > explain in detail what it is good for, what it > provides and how to use it, I (and IMHO many others) > would gain a lot of such a documentation/tutorial. I will try to talk about just what I know, not give too many technical details but rather pointers to the relevant sources of documentation or tips on "What should do in that case?". The goal is just to avoid anyone being stuck more than 2 minutes while trying to extend the syntax of OCaml. > Explaining the details to pwople who already knew > the most stuff, IMHO is not really needed. This can be > done in discussions on the list (or when people > know the tools, they really can look into the sources, > because they know something about what they are intended to do). > > Hoping for a good intruductional tutorial... OK, I will try my best. Martin -- Martin Jambon, PhD Researcher in Structural Bioinformatics since the 20th Century The Burnham Institute http://www.burnham.org San Diego, California ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-23 0:01 ` Martin Jambon @ 2005-02-24 0:47 ` Oliver Bandel 2005-02-24 15:24 ` William D. Neumann 0 siblings, 1 reply; 32+ messages in thread From: Oliver Bandel @ 2005-02-24 0:47 UTC (permalink / raw) To: caml-list On Tue, Feb 22, 2005 at 04:01:05PM -0800, Martin Jambon wrote: > On Tue, 22 Feb 2005, Oliver Bandel wrote: > > [...] > > Because I don't know about what you all are talking here, > > I hope that the intended Camlp4-Tutorial will explain > > such things in more detail. > > I started writing a tutorial this weekend. There are many things to say, > and there are also many things that I ignore... > > > Not another "we know nearly all, and explain some nifty > > details, that you also can see, when looking into the sources > > and study them some months/years" documentation, please... :-> > > > > So, if the indended doc on Camlp4 would > > explain in detail what it is good for, what it > > provides and how to use it, I (and IMHO many others) > > would gain a lot of such a documentation/tutorial. > > I will try to talk about just what I know, not give too many technical > details but rather pointers to the relevant sources of documentation or > tips on "What should do in that case?". > > The goal is just to avoid anyone being stuck more than 2 minutes while > trying to extend the syntax of OCaml. Sounds good. :) Hint: "Just as a picture is worth a thousands words, so is a properly chosen program example." (Stephen G. Kochan, Programming in Objective C, page 2) > > > Explaining the details to pwople who already knew > > the most stuff, IMHO is not really needed. This can be > > done in discussions on the list (or when people > > know the tools, they really can look into the sources, > > because they know something about what they are intended to do). > > > > Hoping for a good intruductional tutorial... > > OK, I will try my best. :) Ciao, Oliver ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) 2005-02-24 0:47 ` Oliver Bandel @ 2005-02-24 15:24 ` William D. Neumann 0 siblings, 0 replies; 32+ messages in thread From: William D. Neumann @ 2005-02-24 15:24 UTC (permalink / raw) To: Oliver Bandel; +Cc: caml-list On Thu, 24 Feb 2005, Oliver Bandel wrote: > Hint: > > "Just as a picture is worth a thousands words, > so is a properly chosen program example." > > (Stephen G. Kochan, Programming in Objective C, page 2) And if I might add, in the other direction: "But a poorly chosen program example is not even worth the number of tokens it contains." (William D. Neumann, This e-mail, page 1) William D. Neumann --- "There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them. Tigers are noble and sleek; children are loud and messy." -- Neko Case Think of XML as Lisp for COBOL programmers. -- Tony-A (some guy on /.) ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation (was: Immediate recursive functions) 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon ` (4 preceding siblings ...) 2005-02-18 8:04 ` [Caml-list] Camlp4 documentation Alex Baretta @ 2005-02-18 8:14 ` Robert M. Solovay 5 siblings, 0 replies; 32+ messages in thread From: Robert M. Solovay @ 2005-02-18 8:14 UTC (permalink / raw) To: Martin Jambon; +Cc: Christian Szegedy, Ocaml I would greatly appreciate such a tutorial. --Bob Solovay On Thu, 17 Feb 2005, Martin Jambon wrote: > On Thu, 17 Feb 2005, Christian Szegedy wrote: > > > Feel free to write your CamlP4 extension ;) > > :-) > But there are few things to know/discover before starting. > > Is anyone interested in a kind of highly practical tutorial on > how to extend the syntax of OCaml with Camlp4? > I could possibly start writing one if there is enough demand. > > > Martin > > -- > Martin Jambon, PhD > Researcher in Structural Bioinformatics since the 20th Century > The Burnham Institute http://www.burnham.org > San Diego, California > > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ^ permalink raw reply [flat|nested] 32+ messages in thread
* Camlp4 documentation @ 2009-05-23 12:24 Jon Harrop 2009-05-23 13:13 ` Re : [Caml-list] " Matthieu Wipliez 0 siblings, 1 reply; 32+ messages in thread From: Jon Harrop @ 2009-05-23 12:24 UTC (permalink / raw) To: caml-list Are the constructions listed here: http://caml.inria.fr/pub/docs/manual-camlp4/manual010.html valid for the new camlp4 as well? For example, <:expr< ( $list:el$ ) >> to deconstruct a tuple. If not, is there equivalent up-to-date documentation anywhere? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re : [Caml-list] Camlp4 documentation 2009-05-23 12:24 Camlp4 documentation Jon Harrop @ 2009-05-23 13:13 ` Matthieu Wipliez 2009-05-23 17:37 ` Christophe TROESTLER 0 siblings, 1 reply; 32+ messages in thread From: Matthieu Wipliez @ 2009-05-23 13:13 UTC (permalink / raw) To: caml-list Most of them are. A tuple is represented as <:expr< ($e$) >> for instance, as can be seen on the Wiki page Abstract Syntax Tree: http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree Cheers, Matthieu ----- Message d'origine ---- > De : Jon Harrop <jon@ffconsultancy.com> > À : caml-list@inria.fr > Envoyé le : Samedi, 23 Mai 2009, 14h24mn 45s > Objet : [Caml-list] Camlp4 documentation > > > Are the constructions listed here: > > http://caml.inria.fr/pub/docs/manual-camlp4/manual010.html > > valid for the new camlp4 as well? > > For example, <:expr< ( $list:el$ ) >> to deconstruct a tuple. > > If not, is there equivalent up-to-date documentation anywhere? > > -- > Dr Jon Harrop, Flying Frog Consultancy Ltd. > http://www.ffconsultancy.com/?e > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: Re : [Caml-list] Camlp4 documentation 2009-05-23 13:13 ` Re : [Caml-list] " Matthieu Wipliez @ 2009-05-23 17:37 ` Christophe TROESTLER 2009-05-23 19:22 ` Jon Harrop 0 siblings, 1 reply; 32+ messages in thread From: Christophe TROESTLER @ 2009-05-23 17:37 UTC (permalink / raw) To: mwipliez; +Cc: caml-list On Sat, 23 May 2009 13:13:23 +0000, Matthieu Wipliez wrote: > > A tuple is represented as <:expr< ($e$) >> Well, at the moment, the better is to complement the information on the wiki with personal experiments in the toploop (and occasionally read the Camlp4 sources). For example, for the above assertion: #directory "+camlp4";; #load "dynlink.cma";; (* OCaml >= 3.11.0 *) #load "camlp4of.cma";; open Camlp4.PreCast;; let _loc = Loc.ghost;; open Syntax;; # let f e = <:expr< ($e$) >>;; val f : 'a -> 'a = <fun> With such a signature, you can imagine that f is just the identity function and you can confirm it with a few experiments. To match a tuple, first look how they are represented: let e = <:expr< x,y,z >>;; val e : Camlp4.PreCast.Syntax.Ast.expr = Camlp4.PreCast.Syntax.Ast.ExTup (<abstr>, Camlp4.PreCast.Syntax.Ast.ExCom (<abstr>, Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "x")), Camlp4.PreCast.Syntax.Ast.ExCom (<abstr>, Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "y")), Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "z"))))) Tuples are thus constructed with "ExTup" which is matched by $tup$ : # match e with <:expr< $tup:t$ >> -> t;; - : Camlp4.PreCast.Syntax.Ast.expr = Camlp4.PreCast.Syntax.Ast.ExCom (<abstr>, Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "x")), Camlp4.PreCast.Syntax.Ast.ExCom (<abstr>, Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "y")), Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "z")))) Then you probably want the individual components that are separated by comas. You can easily write your own function but looking at the Camlp4 sources, you will find that it is already provided : # match e with <:expr< $tup:t$ >> -> Ast.list_of_expr t [];; - : Camlp4.PreCast.Syntax.Ast.expr list = [Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "x")); Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "y")); Camlp4.PreCast.Syntax.Ast.ExId (<abstr>, Camlp4.PreCast.Syntax.Ast.IdLid (<abstr>, "z"))] Hope it helps, C. ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation 2009-05-23 17:37 ` Christophe TROESTLER @ 2009-05-23 19:22 ` Jon Harrop 2009-05-23 19:55 ` Christophe TROESTLER 0 siblings, 1 reply; 32+ messages in thread From: Jon Harrop @ 2009-05-23 19:22 UTC (permalink / raw) To: caml-list On Saturday 23 May 2009 18:37:21 Christophe TROESTLER wrote: > Tuples are thus constructed with "ExTup" which is matched by $tup$ : How did you determine that they are matched with $tup$? > Hope it helps, It does, thank you. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e ^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [Caml-list] Camlp4 documentation 2009-05-23 19:22 ` Jon Harrop @ 2009-05-23 19:55 ` Christophe TROESTLER 0 siblings, 0 replies; 32+ messages in thread From: Christophe TROESTLER @ 2009-05-23 19:55 UTC (permalink / raw) To: jon; +Cc: caml-list On Sat, 23 May 2009 20:22:38 +0100, Jon Harrop wrote: > > On Saturday 23 May 2009 18:37:21 Christophe TROESTLER wrote: > > Tuples are thus constructed with "ExTup" which is matched by $tup$ : > > How did you determine that they are matched with $tup$? Frankly I can't remember. Possibly in camlp4 sources or in a discussion. Regards, C. ^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2009-05-23 19:55 UTC | newest] Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-02-17 15:32 Immediate recursive functions Alex Baretta 2005-02-17 18:20 ` [Caml-list] " Marcin 'Qrczak' Kowalczyk 2005-02-17 19:00 ` Jason Hickey 2005-02-17 20:33 ` Alex Baretta 2005-02-17 19:18 ` Christian Szegedy 2005-02-17 20:36 ` Alex Baretta 2005-02-17 22:39 ` Camlp4 documentation (was: Immediate recursive functions) Martin Jambon 2005-02-17 23:30 ` [Caml-list] " Richard Jones 2005-02-17 23:51 ` Michael Walter 2005-02-18 0:51 ` Micha 2005-02-18 3:37 ` briand 2005-02-18 5:21 ` Oliver Bandel 2005-02-18 6:51 ` Johann Spies 2005-02-18 8:04 ` [Caml-list] Camlp4 documentation Alex Baretta 2005-02-18 8:54 ` Alex Cowie 2005-02-18 16:20 ` Camlp4 with traditional syntax (was: Camlp4 documentation) Hendrik Tews 2005-02-18 16:28 ` [Caml-list] " Alex Baretta 2005-02-18 22:36 ` Hendrik Tews 2005-02-21 12:28 ` Alex Baretta 2005-02-21 12:55 ` Bardur Arantsson 2005-02-21 15:22 ` [Caml-list] Camlp4 with traditional syntax Olivier Andrieu 2005-02-21 16:57 ` Bardur Arantsson 2005-02-18 18:43 ` [Caml-list] Camlp4 with traditional syntax (was: Camlp4 documentation) Martin Jambon 2005-02-18 22:41 ` Hendrik Tews 2005-02-22 10:29 ` Oliver Bandel 2005-02-22 23:32 ` Richard Jones 2005-02-23 0:01 ` Martin Jambon 2005-02-24 0:47 ` Oliver Bandel 2005-02-24 15:24 ` William D. Neumann 2005-02-18 8:14 ` [Caml-list] Camlp4 documentation (was: Immediate recursive functions) Robert M. Solovay 2009-05-23 12:24 Camlp4 documentation Jon Harrop 2009-05-23 13:13 ` Re : [Caml-list] " Matthieu Wipliez 2009-05-23 17:37 ` Christophe TROESTLER 2009-05-23 19:22 ` Jon Harrop 2009-05-23 19:55 ` Christophe TROESTLER
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox