caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Camlp4 quotations for tuples
@ 2009-07-28 11:38 Philippe Veber
  2009-07-28 12:05 ` Philippe Veber
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Veber @ 2009-07-28 11:38 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

Hi list,

Does someone know how to write a camlp4 quotation for types of the form 'a *
'b * 'c * 'd ...  For now I could only obtain types of the form 'a * ('b *
('c * ('d * ... )...))), using a code similar to


 List.fold_right
   (fun x accu -> <:ctyp< $x$ * $accu$ >>)
   (List.tl tuple_types)
   (List.hd tuple_types)


TIA,
ph.

[-- Attachment #2: Type: text/html, Size: 751 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Camlp4 quotations for tuples
  2009-07-28 11:38 Camlp4 quotations for tuples Philippe Veber
@ 2009-07-28 12:05 ` Philippe Veber
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Veber @ 2009-07-28 12:05 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Self-answer, though I'm not sure that's the prettiest way (not even sure it
is even valid) :

<:ctyp< ($Ast.tySta_of_list tuple_types$) >>

ph.


2009/7/28 Philippe Veber <philippe.veber@googlemail.com>

> Hi list,
>
> Does someone know how to write a camlp4 quotation for types of the form 'a
> * 'b * 'c * 'd ...  For now I could only obtain types of the form 'a * ('b *
> ('c * ('d * ... )...))), using a code similar to
>
>
>  List.fold_right
>    (fun x accu -> <:ctyp< $x$ * $accu$ >>)
>    (List.tl tuple_types)
>    (List.hd tuple_types)
>
>
> TIA,
> ph.
>
>

[-- Attachment #2: Type: text/html, Size: 1263 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-28 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-28 11:38 Camlp4 quotations for tuples Philippe Veber
2009-07-28 12:05 ` Philippe Veber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).