From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA24996; Mon, 1 Sep 2003 20:09:57 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA32023 for ; Mon, 1 Sep 2003 20:09:54 +0200 (MET DST) Received: from bastion.artisan.com ([209.144.161.130]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h81I9rf18958 for ; Mon, 1 Sep 2003 20:09:53 +0200 (MET DST) Received: from ypmaster.artisan.com (ypmaster [172.16.2.1]) by bastion.artisan.com (8.9.2/8.9.2) with ESMTP id LAA21538; Mon, 1 Sep 2003 11:09:43 -0700 (PDT) Received: from barrow.artisan.com (barrow.artisan.com [172.16.10.17]) by ypmaster.artisan.com (8.9.2/8.9.2) with ESMTP id LAA10904; Mon, 1 Sep 2003 11:09:42 -0700 (PDT) Received: (from johnm@localhost) by barrow.artisan.com (8.11.6/8.11.6) id h81I9gZ24955; Mon, 1 Sep 2003 11:09:42 -0700 From: John Gerard Malecki MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16211.35686.771730.386438@barrow.artisan.com> Date: Mon, 1 Sep 2003 11:09:42 -0700 To: "Lukasz Stafiniak" Cc: Subject: RE: [Caml-list] Let-in vs beta-redex In-Reply-To: <000e01c370a4$592d6300$3bef4dd5@ppp> References: <000e01c370a4$592d6300$3bef4dd5@ppp> X-Mailer: VM 7.16 under Emacs 21.3.1 Reply-To: "John Gerard Malecki" X-Organization: Artisan Components, Inc. X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 lukasz:01 conceptually:01 ocamlc:01 'ocaml:01 -dinstr:01 3.07:01 const:01 ccall:01 ccall:01 const:01 ocaml:01 caml:01 closure:01 mul:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Lukasz Stafiniak wrote (2003-09-01T18:15:54+0200): > Hi, > > Is let-in more efficient than beta-redex or are they computationally > equivalent? Is let-in a syntax-sugar of beta-redex? They may be conceptually different but they compile to pretty much teh same thing. A nice trick to learn about the code that ocamlc generates is to use 'ocaml -dinstr'. For example, :; ocaml -dinstr Objective Caml version 3.07+beta 2 # let x = sin 2. in x *. x *. x;; const 2. ccall sin_float, 1 push acc 0 push acc 1 push acc 2 ccall mul_float, 2 ccall mul_float, 2 return 2 - : float = 0.751826944668992803 # (fun x -> x *. x *. x) (sin 2.);; const 2. ccall sin_float, 1 push closure L1, 0 appterm 1, 2 L1: acc 0 push acc 1 push acc 2 ccall mul_float, 2 ccall mul_float, 2 return 1 - : float = 0.751826944668992803 # ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners