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 PAA19463; Mon, 18 Jun 2001 15:29:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA19525 for ; Mon, 18 Jun 2001 15:29:52 +0200 (MET DST) Received: from areca.wanadoo.fr (smtp-rt-4.wanadoo.fr [193.252.19.156]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f5IDTp127103 for ; Mon, 18 Jun 2001 15:29:51 +0200 (MET DST) Received: from mahonia.wanadoo.fr (193.252.19.58) by areca.wanadoo.fr; 18 Jun 2001 15:29:51 +0200 Received: from debian (195.6.74.119) by mahonia.wanadoo.fr; 18 Jun 2001 15:29:34 +0200 Received: from moi by debian with local (Exim 3.22 #1 (Debian)) id 15C0no-0000Ln-00 for ; Mon, 18 Jun 2001 17:18:56 +0200 To: caml Subject: Re: [Caml-list] Newbie: declarations References: <20010616170909.B10922@jean> <20010617191903.D2105@jean> From: Remi VANICAT Date: 18 Jun 2001 17:18:56 +0200 In-Reply-To: <20010617191903.D2105@jean> Message-ID: <87lmmp6ckf.dlv@wanadoo.fr> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.103 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk leary@nwlink.com writes: > On Sun, Jun 17, 2001 at 02:08:28PM +0400, Vitaly Lugovsky wrote: > > It's an almost functional language, so please avoid variables. And use > > references only when you really need 'em. Refer to the Guide about > > references and named tuples. > > Here's what I'm doing now (comments welcome; yes, I have short cryptic > names). I'm writing a robot for RealTimeBattle, and want to have access to > information that isn't contained in every message the robot gets (and I'm > not using threads or signals yet, fwiw). This information is updated all > the time. (I'll post a link to the whole thing for criticism, once it > actually does something interesting. :) [...] > let data : datarec = { the type annotation is not mandatory : let data = is enough [...] > > let initialize i = match i with > 1 -> name "Bob"; color "00FF00 FF0000"; > debug "initialize 1\n"; > | 0 -> > data.name <- "bob"; [...] it may be better to have two function : one to initialize the robot, the other to make the other stuff. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr