Version française
Home     About     Download     Resources     Contact us    
Browse thread
Value shadowing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brighten Godfrey <pbg@c...>
Subject: Re: [Caml-list] Value shadowing (tangent)
Going off on a tangent here...

On Aug 13, 2008, at 2:56 AM, David Allsopp wrote:
>
> let lst = [5; 4; 3; 2; 1; 0; -1; -2; -3; -4; -5]
> in
>   let filter = List.filter (fun x -> x > 0)
>   in
>     let double = List.map (fun x -> -2 * x)
>     in
>       let sort = List.sort compare
>       in
>         (sort $$ double $$ filter) lst

I've seen little of other people's OCaml code, so out of curiosity,  
do you or others actually write code formatted like the above, as  
opposed to the more compact and (I think) readable

     let lst = [5; 4; 3; 2; 1; 0; -1; -2; -3; -4; -5] in
     let filter = List.filter (fun x -> x > 0) in
     let double = List.map (fun x -> -2 * x) in
     let sort = List.sort compare in
     (sort $$ double $$ filter) lst

?

~Brighten