Using labels makes this kind of code more readable.

  open StdLabels

  let x = List.map my_list ~f:
    begin fun z ->
      very_blabla
    end in
  ...

Jacques Garrigue

From: DooMeeR <[EMAIL PROTECTED]>

> Another possibility is:
> 
> let x = List.map begin fun z ->
>   very_blabla
> end my_list in
> 
> It's quite compact, doesn't run into the margin, is consistent with 
> tuareg, but might be less readable.
> 
> -- 
> Romain Bardou
> 
> Dave Benjamin a écrit :
> > Romain Bardou wrote:
> >> let x = List.map (fun z ->
> >>                     very_long_stuff_blablablablablablablabla)
> >
> > I tend to write this sort of thing as:
> >
> > let x =
> >   List.map
> >     (fun z ->
> >        very_long_stuff_blablablablablablablabla)
> >     ...
> >
> > which, as you may notice, still can't be done with tabs alone due to 
> > the extra space after the opening parenthesis. I'm curious what you 
> > all think of this coding style, which seems on one hand to be 
> > excessively... um, vertical? but it does seem to strike a balance 
> > between Tuareg's indentation rules and the problem of "running into 
> > the margin" too quickly.
> >
> > BTW, If you keep the function on the first line, it's a bit more 
> > compact, but the indentation no longer tells the truth about the real 
> > hierarchy:
> >
> > let x = List.map
> >   (fun z ->
> >      very_long_stuff_blablablablablablablabla)
> >   ...
> >
> > This is why I tend to put the function on a line of its own as soon as 
> > things start to wrap.
> >
> > Dave
> >
> > _______________________________________________
> > 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
> 
> _______________________________________________
> 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

_______________________________________________
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

Reply via email to