Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Efficiency of let/and
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-26 (17:04)
From: Mackenzie Straight <eizneckam@g...>
Subject: Re: Ant: [Caml-list] Efficiency of let/and
On 9/26/05, Brian Hurt <> wrote:
> Syntactically and semantically there is no difference.  I was wondering if
> the ocamlopt compiler took advatange of the implicit paralellism at all.

In any case, it makes (as far as I know) no difference which syntax you use:

% ocaml -drawlambda
        Objective Caml version 3.08.3

# let foo a1 a2 = let l1 = Array.length a1 and l2 = Array.length a2 in l1+l2;;
     (function a1/66 a2/67
       (let (l1/68 (array.length a1/66) l2/69 (array.length a2/67))
         (+ l1/68 l2/69))))
  (apply (field 1 (global Toploop!)) "foo" foo/65))
val foo : 'a array -> 'b array -> int = <fun>
# let bar a1 a2 = let l1 = Array.length a1 in let l2 = Array.length a2
in l1+l2;;
     (function a1/71 a2/72
       (let (l1/73 (array.length a1/71) l2/74 (array.length a2/72))
         (+ l1/73 l2/74))))
  (apply (field 1 (global Toploop!)) "bar" bar/70))
val bar : 'a array -> 'b array -> int = <fun>