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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 97D3ABC57 for ; Tue, 9 Feb 2010 23:14:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoMCAABtcUtIDtyYkGdsb2JhbACDCZdVCBUBAQEBCQkMBxMDIK0eLgqBQIVSiHEBAQMFgSqCSlsEiVqBVA X-IronPort-AV: E=Sophos;i="4.49,438,1262559600"; d="scan'208";a="44347339" Received: from fg-out-1718.google.com ([72.14.220.152]) by mail3-smtp-sop.national.inria.fr with ESMTP; 09 Feb 2010 23:14:32 +0100 Received: by fg-out-1718.google.com with SMTP id 19so30230fgg.3 for ; Tue, 09 Feb 2010 14:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=LvY/JHFoqAGUHI7IjGKWW6+pR0ewna4zvPcYrok+1RQ=; b=QLBjjCq4kAm4lv0hxkESsEShOUNbipjTPgZRC3hv4+FwNwatQok64d5l2X5rbIb+Dz 95c0XScKImdGdeIx2IBOkhk06cH6SmvtxMVPmjCQHfFOUPy7cdcVx5EEjMbN/JBv92tf YJTW/QW3KGbu0tX/7w4nPHHXpxSie6VtzhOUg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; b=QnrQgrku+TOoz55Tdv1mf+Yc42ly4fhF9f4UXIFDW4f2+3kv1kBNR2xbnACxSRWgaT fTHHYfSgUreKEp0comnctaDDQRunjbaAUdD7J2varGrj/Q6kR2rSp1OHsHlkj5bdNh6W s5NaZITcfpffEPFdfZ42NQJP8/FmhGybCtnrY= MIME-Version: 1.0 Received: by 10.239.183.147 with SMTP id u19mr900145hbg.106.1265753672143; Tue, 09 Feb 2010 14:14:32 -0800 (PST) Reply-To: saptarshi.guha@gmail.com In-Reply-To: <4B71D9BB.3090605@citycable.ch> References: <1e7471d51002091250of7a686fq537a03c9401c868f@mail.gmail.com> <4B71D9BB.3090605@citycable.ch> From: Saptarshi Guha Date: Tue, 9 Feb 2010 17:14:12 -0500 Message-ID: <1e7471d51002091414k35830faapb321b8ab7f1546e1@mail.gmail.com> Subject: Re: [Caml-list] The need to specify 'rec' in a recursive function defintion To: guillaume.yziquel@citycable.ch Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; recursive:01 defintion:01 ocaml:01 recursive:01 guillaume:01 recursively:01 caml-list:01 defined:02 defined:02 let:03 let:03 specify:06 indeed:07 function:08 function:08 Thanks, very helpful. >> let f =3D fun x -> x + 1 (1) >> >> let f x =3D f (f x) (2) This works in ocaml because, it replaces f (in (2) ) from that of (1). Which is why i need f previously defined. Correct me if i'm wrong. > >> Wouldn't one of way of detecting a recursive function would be to see >> if the indeed the function calls itself? > > No. Because you never know if you intended to call the function recursive= ly, > or if you intended to call an homonymous function you defined before. > Very true, hadn't considered this. > All the best, > > -- > =C2=A0 =C2=A0 Guillaume Yziquel > http://yziquel.homelinux.org/ >