caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* camlp4 3.10: Tuple processing
@ 2007-04-30 14:34 Joel Reymont
  2007-04-30 14:40 ` Joel Reymont
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2007-04-30 14:34 UTC (permalink / raw)
  To: Caml List

Looking at Martin's json code I find this example of tuple conversion  
in the old syntax:

       | Tuple l ->
           let tl = List.map convert l in
           <:ctyp< ( $list:tl$ ) >>

In the new syntax the same code becomes something much larger:

       | Tuple l ->
           (* (* Development version post-3.10.0+beta: *)
              let tl = List.map convert l in
              <:ctyp< ( $tup:Ast.tySta_of_list tl$ ) >> *)
           let t =
             List.fold_right
               (fun x tup -> <:ctyp< $convert x$ * $tup$ >>)
               l <:ctyp< >> in
           <:ctyp< $tup:t$ >>

What is the advantage of the new approach and how did it become so  
verbose?

	Thanks, Joel

[1] http://martin.jambon.free.fr/examples/pa_json_static_3100beta.html

--
http://wagerlabs.com/






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

* Re: camlp4 3.10: Tuple processing
  2007-04-30 14:34 camlp4 3.10: Tuple processing Joel Reymont
@ 2007-04-30 14:40 ` Joel Reymont
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Reymont @ 2007-04-30 14:40 UTC (permalink / raw)
  To: Caml List

I think I missed the point after getting confused by the comments and  
that $tup:Ast.tySta_of_list tl$.

It looks like just <:ctyp< $tup:t$ >>  is needed, my apologies for  
the confusion!

On Apr 30, 2007, at 3:34 PM, Joel Reymont wrote:

>       | Tuple l ->
>           (* (* Development version post-3.10.0+beta: *)
>              let tl = List.map convert l in
>              <:ctyp< ( $tup:Ast.tySta_of_list tl$ ) >> *)
>           let t =
>             List.fold_right
>               (fun x tup -> <:ctyp< $convert x$ * $tup$ >>)
>               l <:ctyp< >> in
>           <:ctyp< $tup:t$ >>

--
http://wagerlabs.com/






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

end of thread, other threads:[~2007-04-30 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-30 14:34 camlp4 3.10: Tuple processing Joel Reymont
2007-04-30 14:40 ` Joel Reymont

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