🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.caml
Article #73

Labels in recursive functions.

#73
From: Benson
Date: Mon, 10 Sep 2012 01:45
11 lines
1497 bytes
Apparently if I declare a recursive function with a formal parameter that has a label, I *must* use the label when calling the function in the body of the function.  Why is that?

E.g., I cannot write:

let rec f ~n  = match n with 0 ->1 | _ -> n * (f (n-1));;   

I must either write:

let rec f n  = match n with 0 ->1 | _ -> n * (f (n-1));;
let rec f ~n = match n with 0 ->1 | _ -> n * (f ~n:(n-1));;
Technical Details
Message-ID: <9047ec42-703d-4594-9077-9ad10346d7c2@googlegroups.com>
Path: arc1-ca.pugleaf.net!da15ni13100845qab.0!nntp.google.com!v8no1214361qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: c0fe4b917e,267afb8d8170dec2,start
X-Google-Attributes: gidc0fe4b917e,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Received: by 10.224.111.8 with SMTP id q8mr5659499qap.3.1347241511650;
        Sun, 09 Sep 2012 18:45:11 -0700 (PDT)
Received: by 10.236.201.134 with SMTP id b6mr1555024yho.15.1347241511583; Sun,
 09 Sep 2012 18:45:11 -0700 (PDT)
Path: arc1-ca.pugleaf.net!da15ni13100845qab.0!nntp.google.com!v8no1214361qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: fa.caml
Date: Sun, 9 Sep 2012 18:45:11 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.68.80.182; posting-account=_OyvxQoAAACXYRywZF21tIZrU66sk3Nh
NNTP-Posting-Host: 76.68.80.182
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9047ec42-703d-4594-9077-9ad10346d7c2@googlegroups.com>
Subject: Labels in recursive functions.
From: Benson <benson.bear@gmail.com>
Injection-Date: Mon, 10 Sep 2012 01:45:11 +0000
Content-Type: text/plain; charset=ISO-8859-1