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 AAA01677; Tue, 5 Jun 2001 00:14:17 +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 AAA01856 for ; Tue, 5 Jun 2001 00:14:16 +0200 (MET DST) Received: from web11906.mail.yahoo.com (web11906.mail.yahoo.com [216.136.172.190]) by concorde.inria.fr (8.11.1/8.10.0) with SMTP id f54MEED01505 for ; Tue, 5 Jun 2001 00:14:15 +0200 (MET DST) Message-ID: <20010604221414.49620.qmail@web11906.mail.yahoo.com> Received: from [24.221.171.193] by web11906.mail.yahoo.com; Mon, 04 Jun 2001 15:14:14 PDT Date: Mon, 4 Jun 2001 15:14:14 -0700 (PDT) From: Tom _ Subject: Re: [Caml-list] OCaml Speed for Block Convolutions To: William Chesters , caml-list@inria.fr In-Reply-To: <15131.59080.327155.47983@beertje.william.bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > E.g. > > let a = ref 0. in > for i = 0 to n-1 do > a := !a +. Array.unsafe_get xs i > done Incidentally, rather than trying to come up with other workaround for imperative variables, maybe it would be better to just make the straightforward functional implementation fast: let loop i total = if i=n then total else loop (i+1) (total + Array.unsafe_get xs i) in loop 0 0.0 In fact, in a compiler that already has TRO and type inference, shouldn't this be entirely equivalent to an imperative loop? Another approach would be to adopt a "functional" loop syntax as found in languages like SISAL. Tom. __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr