From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7DA5BBC75 for ; Thu, 17 Feb 2005 19:20:12 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j1HIKCCw004236 for ; Thu, 17 Feb 2005 19:20:12 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA01990 for ; Thu, 17 Feb 2005 19:20:11 +0100 (MET) Received: from qrnik.knm.org.pl (paf87.warszawa.sdi.tpnet.pl [217.96.225.87]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j1HIKApF003785 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 17 Feb 2005 19:20:11 +0100 Received: from qrczak by qrnik.knm.org.pl with local (Exim 3.36 #1) id 1D1qG1-0006uB-00 for caml-list@inria.fr; Thu, 17 Feb 2005 19:20:09 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Immediate recursive functions X-Face: OW>RV&gN+&b-aiNY|U)f=S%w+/rK!);f>/W9IXg})]&F>ht.1Up8@04+_!gOp(_/l_-+E^. 2\vI)1=D,%HWiq)r(M/V~dr^5T^KF/[w5YZ4<0Sus3+O>l3uA/&W_21m?.s,Po8{pb0@ References: <4214B8F1.7010402@barettadeit.com> From: "Marcin 'Qrczak' Kowalczyk" Mail-Followup-To: caml-list@inria.fr Date: Thu, 17 Feb 2005 19:20:09 +0100 In-Reply-To: <4214B8F1.7010402@barettadeit.com> (Alex Baretta's message of "Thu, 17 Feb 2005 16:32:01 +0100") Message-ID: <877jl782w6.fsf@qrnik.zagroda> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: "Marcin 'Qrczak' Kowalczyk" X-Miltered: at concorde with ID 4214E05C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4214E05A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 recursive:01 baretta:01 rec:01 pred:01 rec:01 pred:01 syntax:01 ocaml's:01 'let':01 writes:01 functions:01 int:01 int:01 alex:03 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: Alex Baretta writes: > I sometimes feel the need for a mu operator. I'm thinking of something > like the following: > > # (rec f x -> if x <= 0 then 1 else x * (f (pred x))) 5 > - : int = 120 > > as opposed to > > (let rec f x = if x <= 0 then 1 else x * (f (pred x)) in f) 5 > - : int = 120 Here it is immediately applied to arguments. For such cases my language Kogut provides a syntax: loop 5 [ x {if (x <= 0) {1} else {x * again (x - 1)}} ] or with pattern matching: loop 5 [ (<= 0) {1} x {x * again (x - 1)} ] This is related to 'case' (OCaml's 'match') like in Scheme "named let" is related to ordinary 'let', except that the name 'again' is implicit. There can be more arguments than one. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/