Browse thread
Value shadowing
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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) |
On Aug 13, 2008, at 3:49 AM, Brighten Godfrey wrote: > 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 > > ? P.S. Sorry David, on second read I sounded pretty elitist there! I realize this is all subjective and my habits are no more valid than others'. I am curious, though, what styles people have adopted. Thanks, ~Brighten