From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4F09EBB9C for ; Sun, 18 Sep 2005 17:48:24 +0200 (CEST) Received: from ptb-relay04.plus.net (ptb-relay02.plus.net [212.159.14.213]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8IFmNdl003663 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sun, 18 Sep 2005 17:48:24 +0200 Received: from [80.229.56.224] (helo=chetara) by ptb-relay04.plus.net with esmtp (Exim) id 1EH1Oy-0001Zc-0s for caml-list@yquem.inria.fr; Sun, 18 Sep 2005 16:48:24 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] lisp to ocaml Date: Sun, 18 Sep 2005 16:44:58 +0100 User-Agent: KMail/1.7.2 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200509181644.58661.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 432D8C47.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 factorial:01 factorial:01 rec:01 replacing:01 literals:01 ocaml:01 frog:98 wrote:01 compile:01 lisp:01 lisp:01 caml:02 objective:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Sunday 18 September 2005 15:06, Thomas Fischbacher wrote: > You cannot directly compile LISP code to ML code in the sense that > > (defun factorial (n) > (labels > ((walk (so-far todo) > (if (= todo 0) > so-far > (walk (* so-far todo) (- todo 1))))) > (walk 1 n))) > > would become > > let factorial n = > let rec walk so_far todo = > if todo=0 > then so_far > else walk (so_far*todo) (todo-1) > in walk 1 n > ;; > > for a ton of reasons. In this case, what else is needed beyond replacing operators with those suitable for a generalised numeric type and constructing numeric literals? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists