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=2.1 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1899ABB84 for ; Wed, 13 Aug 2008 15:52:44 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEBACKEokjRVYC5lGdsb2JhbACROD4BAQEBCQMKBxEDnSCHQQEC X-IronPort-AV: E=Sophos;i="4.32,201,1217800800"; d="scan'208";a="15968017" Received: from fk-out-0910.google.com ([209.85.128.185]) by mail3-smtp-sop.national.inria.fr with ESMTP; 13 Aug 2008 15:52:43 +0200 Received: by fk-out-0910.google.com with SMTP id k31so4505320fkk.11 for ; Wed, 13 Aug 2008 06:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=HNo8h1TOAEdm5ncbtx3J+ukaIYAy1EaDZ9F8R/3yFkw=; b=hAEv1Sw1Jm0OvUI1S9T9rStsTXYsmfATJ4LgKTo3+TfghlhTO7WADO3KtjuHCYXZi6 WzNzgystBo5mhiZN+u17VGMWxa8z/fX94jEHEcGr+CygNaKxL5tNi+BOO+v1jZxCdeSi wvToIj8WBNHA0if2NCtsaBAw2YllXGGhhNeZ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=sgJGJFHfA2NSgmEblF2rnotT1s9L7am6VCr4qG0FLNByutJXxcR8dz6rFKvIpyhu4l NW0XKdLfR3fg2k0GhxgSt3mRcHd8TzyEd6w+1hVvGXgq6EkV2HvWyIovksWHZpmffQSA dsqFTCC1uMt+flCHIahMC2e6zsqJHVpEMGjO0= Received: by 10.181.29.18 with SMTP id g18mr5854424bkj.1.1218635563063; Wed, 13 Aug 2008 06:52:43 -0700 (PDT) Received: by 10.181.17.17 with HTTP; Wed, 13 Aug 2008 06:52:43 -0700 (PDT) Message-ID: Date: Wed, 13 Aug 2008 09:52:43 -0400 From: "Jean Krivine" To: "circ ular" Subject: Re: [Caml-list] Difference between "let rec" and just "let"? Cc: caml-list@yquem.inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Spam: no; 0.00; krivine:01 krivine:01 recursive:01 recursive:01 val:01 val:01 beginner's:01 ocaml:01 bug:01 beginners:01 wrote:01 rec:01 rec:01 caml-list:01 caml-list:01 Each time you use let, you can also use let rec, but you have to use the rec (for recursive) if you want to declare a recursive function as in: let rec f x = if x<0 then 0 else x * f(x-1) On Wed, Aug 13, 2008 at 8:49 AM, circ ular wrote: > what is the difference between "let rec" and just "let"? what does rec > stand for? > > are the following defintions exactly the same? at least they seem to > give the same results... > > # let rec cube x = x*x*x;; > val cube : int -> int = > # cube 12;; > - : int = 1728 > > # let cubex x = x*x*x;; > val cubex : int -> int = > # cubex 12;; > - : int = 1728 > # > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >