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 RAA18914; Tue, 23 Dec 2003 17:20:08 +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 RAA18352 for ; Tue, 23 Dec 2003 17:20:07 +0100 (MET) Received: from mwinf0303.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.28]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hBNGK6b18721 for ; Tue, 23 Dec 2003 17:20:06 +0100 (MET) Received: from iliana (AStrasbourg-206-1-2-163.w217-128.abo.wanadoo.fr [217.128.59.163]) by mwinf0303.wanadoo.fr (SMTP Server) with ESMTP id 2898250008F0; Tue, 23 Dec 2003 17:20:06 +0100 (CET) Received: from luther by iliana with local (Exim 3.36 #1 (Debian)) id 1AYpGO-0006ao-00; Tue, 23 Dec 2003 17:20:04 +0100 Date: Tue, 23 Dec 2003 17:20:04 +0100 To: Brian Hurt Cc: Tyler Eaves , caml-list@inria.fr Subject: Re: [Caml-list] Frustrated Beginner Message-ID: <20031223162004.GA25221@iliana> References: <1072152186.59938.30.camel@tylere> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i From: Sven Luther X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sven:01 luther:01 sven:01 luther:01 ocaml:01 int:01 int:01 syntax:02 constructs:02 mmm:02 comparison:02 unit:03 wrote:03 trick:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Dec 23, 2003 at 11:11:19AM -0500, Brian Hurt wrote: > > My biggest source of problems seems to be the syntax. I'm totally > > confused as far as ; vs ;; vs nothing, when to use ( ), and things of > > the like. > > This took some rethinking on my part as well. The trick is to remember > that ';' is an operator, like '+' and '.' are. Actually, the best > comparison is with the comma operator in C. If the type of '+' is int -> > int -> int ('+' takes two int parameters and returns an int), then the > type of the ';' operator is unit -> 'a -> 'a (or more correctly, 'a -> 'b > -> 'b). One you start thinking of ';' as an operator and not a statement > seperator, it becomes more obvious that an ocaml function body is simply a > single expression, and not a series of statements. ';;' is more close to > what ';' in most languages mean- it's what ends an expression. Mmm, not really convinced. For me ;, is a shortcut for : let () = ... in Actually, i believe that both constructs result in the exact same code. That said, i guess it would not really help someone coming from the imperative world, and not used to the let ... = ... in construct. Friendly, Sven Luther ------------------- 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