From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA32482; Fri, 22 Nov 2002 01:31:43 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA32472 for ; Fri, 22 Nov 2002 01:31:42 +0100 (MET) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from mail.fltrp.com ([211.101.185.130]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAM0VdX20290 for ; Fri, 22 Nov 2002 01:31:40 +0100 (MET) Received: from delbian [129.0.5.6] by mail.fltrp.com with ESMTP (SMTPD32-7.13) id A9F2F600DE; Fri, 22 Nov 2002 08:27:30 +0800 Content-Type: text/plain; charset="gb2312" From: Yang Shouxun Organization: FLTRP To: caml-list@inria.fr Subject: Re: [Caml-list] "in" question Date: Fri, 22 Nov 2002 08:29:32 +0800 User-Agent: KMail/1.4.3 References: <170826586F3BD511910D0200C110AAA8032B4F3C@memail03.bco-home.com> In-Reply-To: <170826586F3BD511910D0200C110AAA8032B4F3C@memail03.bco-home.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200211220829.32967.yangsx@fltrp.com> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Friday 22 November 2002 07:35, mzukowski@yci.com wrote: > I've been working through Jason Hickey's introduction to Objective Caml and > don't quite get why the "in" is necessary in this construct: > > # let sum i = let sum2 j = i + j in sum2 ;; > val sum : int -> int -> int = > > If I leave out the "in" I get a generic "Syntax error": > > # let sum i = let sum2 j = i + j ;; > Characters 31-33: > let sum i = let sum2 j = i + j ;; In OCaml "let" can be used in two ways: 1. toplevel declaration "let" 2. local declaration "let...in" Since "let sum2" is not toplevel, it must be the local form "let...in". ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners