Version française
Home     About     Download     Resources     Contact us    
Browse thread
If OCaml were a car
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] If OCaml were a car
From: Jon Harrop <jon@ffconsultancy.com>
> On Wednesday 22 August 2007 06:50:24 Luca de Alfaro wrote:
> > The only thing about Ocaml I mind, is that it a bit like German is, in that
> > all the verbs at the end come.  And there nothing wrong is, but it for some
> > strange reading makes, and it strange is that this from France comes.
> >
> > I still somewhat puzzled am, at reading:
> >
> > let f x =
> >   [humonguous definition 50 lines spanning]
> > in List.iter f l
> >
> > because the only way I make sense of this can, is by first looking at where
> > f used is, and only then reading its definition.
> > I much rather write would:
> >
> > do List.iter f l
> > where f x = [humonguous definition]
> >
> > Maybe this problem with Ocamlp4 solvable is?
> 
> Get this to good effect in vanilla OCaml by copying F# you can:
> 
>   let ( |> ) x f = f x
> 
>   l |> List.iter
>     (fun e -> ...)

Or, sugar-free,

  open StdLabels

  List.iter l ~f:
  begin fun x ->
    ...
  end

Jacques Garrigue