Let and construct versus let in sequence

Posted by Stringer on Stack Overflow See other posts from Stack Overflow or by Stringer
Published on 2012-09-08T14:20:05Z Indexed on 2012/09/08 15:38 UTC
Read the original article Hit count: 190

Filed under:
|
|

Consider this OCaml code:

let coupe_inter i j cases =
  let lcases = Array.length cases in
  let low,_,_ = cases.(i)
  and _,high,_ = cases.(j) in
  low,high,
  Array.sub cases i (j-i+1),
  case_append (Array.sub cases 0 i) (Array.sub cases (j+1) (lcases-(j+1)))

Why the expression let ... and ... in is used in place of a let ... in let ... in sequence (like F# force you to do)? This construct seems quite frequent in OCaml code. Thanks!

© Stack Overflow or respective owner

Related posts about coding-style

Related posts about F#