From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL,NO_REAL_NAME autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 02AC7BC69 for ; Thu, 4 Oct 2007 23:36:42 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABb6BEeGYAcfnmdsb2JhbACOOAEBAQEHBAYp X-IronPort-AV: E=Sophos;i="4.21,232,1188770400"; d="scan'208";a="2394468" Received: from theia.rz.uni-saarland.de ([134.96.7.31]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Oct 2007 23:36:41 +0200 Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by theia.rz.uni-saarland.de (8.14.1/8.14.0) with ESMTP id l94LaaNj027798; Thu, 4 Oct 2007 23:36:36 +0200 Received: from mail.ps.uni-sb.de (james.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.14.1/2007091300) with ESMTP id l94LaZF0002685; Thu, 4 Oct 2007 23:36:35 +0200 (CEST) Received: from localhost ([127.0.0.1] helo=www.ps.uni-sb.de ident=www-data) by mail.ps.uni-sb.de with esmtp (Exim 4.63) (envelope-from ) id 1IdYN1-0005sm-Ji; Thu, 04 Oct 2007 23:36:35 +0200 Received: from 84.159.34.129 (SquirrelMail authenticated user rossberg) by www.ps.uni-sb.de with HTTP; Thu, 4 Oct 2007 23:36:35 +0200 (CEST) Message-ID: <60663.84.159.34.129.1191533795.squirrel@www.ps.uni-sb.de> In-Reply-To: <1191530384.7078.102.camel@rosella.wigram> References: <1175664498.24614.5.camel@rosella.wigram> <20071004194808.6d7e1136@localhost.localdomain> <1191530384.7078.102.camel@rosella.wigram> Date: Thu, 4 Oct 2007 23:36:35 +0200 (CEST) Subject: Re: [Caml-list] Re: How important are circular lists/recursive objects? From: rossberg@ps.uni-sb.de To: "skaller" Cc: caml-list@yquem.inria.fr User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: rossberg@ps.uni-sb.de X-SA-Exim-Scanned: No (on mail.ps.uni-sb.de); SAEximRunCond expanded to false X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (theia.rz.uni-saarland.de [134.96.7.31]); Thu, 04 Oct 2007 23:36:36 +0200 (CEST) X-AntiVirus: checked by AntiVir MailGate (version: 2.1.2-14; AVE: 7.6.0.20; VDF: 7.0.0.51; host: AntiVir1) X-Spam: no; 0.00; recursive:01 rossberg:01 bindings:01 fpls:01 semantics:01 fixpoint:01 ocaml:01 haskell:01 fibs:01 fibs:01 ocaml:01 -rectypes:01 sourceforge:01 closures:01 wrote:01 skaller wrote: > > Other than use of a function closure > to create a box, let/in bindings cannot create cycles because > non-functional values have to be constructed from existing > already initialised values. > > So apart from functional closures, FPLs can't have cycles That's solely a question of the semantics of their fixpoint operator. Ocaml certainly supports "let rec xs = 1::xs". And just for perspecive, the following is the canonical definition of the (infinite) list of Fibonacci numbers in Haskell: fibs = 1:1:zipWith (+) fibs (tail fibs) > Note that stuff like: > > let rec x= (1,x) > > is not generally allowed: in functional terms it is ill-defined, It is disallowed in OCaml because it has a cyclic type, not because it is a cyclic value. Try with "ocaml -rectypes". - Andreas