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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id ED7AFBB9C for ; Sun, 18 Sep 2005 18:08:31 +0200 (CEST) Received: from mail.physik.uni-muenchen.de (mail.physik.uni-muenchen.de [192.54.42.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j8IG8V5P028218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 18 Sep 2005 18:08:31 +0200 Received: from localhost (unknown [127.0.0.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id 1DDD72000C; Sun, 18 Sep 2005 18:08:31 +0200 (CEST) Received: from mail.physik.uni-muenchen.de ([127.0.0.1]) by localhost (mail.physik.uni-muenchen.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23693-01-20; Sun, 18 Sep 2005 18:08:22 +0200 (CEST) Received: from mailhost.cip.physik.uni-muenchen.de (kaiser.cip.physik.uni-muenchen.de [141.84.136.1]) by mail.physik.uni-muenchen.de (Postfix) with ESMTP id 252C120010; Sun, 18 Sep 2005 18:08:22 +0200 (CEST) Received: from eiger.cip.physik.uni-muenchen.de (eiger.cip.physik.uni-muenchen.de [141.84.136.54]) by mailhost.cip.physik.uni-muenchen.de (Postfix) with ESMTP id 6FD7326F4D; Sun, 18 Sep 2005 18:08:21 +0200 (CEST) Received: by eiger.cip.physik.uni-muenchen.de (Postfix, from userid 3092) id 7E5AA12F75; Sun, 18 Sep 2005 18:08:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eiger.cip.physik.uni-muenchen.de (Postfix) with ESMTP id 790D312F17; Sun, 18 Sep 2005 18:08:21 +0200 (CEST) Date: Sun, 18 Sep 2005 18:08:21 +0200 (CEST) From: Thomas Fischbacher To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] lisp to ocaml In-Reply-To: <200509181644.58661.jon@ffconsultancy.com> Message-ID: References: <200509181644.58661.jon@ffconsultancy.com> X-BOFH: Daemons did it MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: amavisd-new at physik.uni-muenchen.de X-Miltered: at concorde with ID 432D90FF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 replacing:01 literals:01 subset:01 flatten:01 flatten:01 foo:01 1337:01 baz:01 2005,:98 ...:98 cip:98 cip:98 lambda:01 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=SPF_FAIL autolearn=disabled version=3.0.3 On Sun, 18 Sep 2005, Jon Harrop wrote: > > You cannot directly compile LISP code to ML code in the sense that > > (...) > > 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? I have to correct my statement: You cannot compile Common Lisp code to ML code that expresses the same idea short of piping it through an intelligent human who is proficient with both languages, and can use intelligent judgment to make decisions about what "the same idea" is supposed to mean. The question whether there is an interesting subset of Common LISP which can automatically be mapped directly to ML in such a way that there is a direct correspondence between the fundamental data types (i.e. lists are represented as lists) is a different one. May I ask you to have a try here: (defun flatten (tree) (cond ((consp tree) (append (flatten (car tree)) (flatten (cdr tree)))) ((null tree) nil) (t (list tree)))) (flatten '("foo" (bar (1337 "baz") ("some" "more") ("pieces" "of" ("data")) "here"))) -- regards, tf@cip.physik.uni-muenchen.de (o_ Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\ (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_ (if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)