caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
To: caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Newbie: declarations
Date: 18 Jun 2001 17:18:56 +0200	[thread overview]
Message-ID: <87lmmp6ckf.dlv@wanadoo.fr> (raw)
In-Reply-To: <20010617191903.D2105@jean>

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


  reply	other threads:[~2001-06-18 13:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-17  0:09 leary
2001-06-17 10:08 ` Vitaly Lugovsky
2001-06-18  2:19   ` leary
2001-06-18 15:18     ` Remi VANICAT [this message]
2001-06-18 20:19       ` [Caml-list] Good introduction for the working programmer in Objective CAML Mattias Waldau
2001-06-18 20:35         ` Miles Egan
2001-06-18 20:49         ` leary
2001-06-17 15:33 ` [Caml-list] Newbie: declarations David Fox
2001-06-18 14:52   ` FabienFleutot
2001-06-19  8:11 ` Frédéric van der Plancke
2001-06-19 10:22   ` Sven LUTHER
2001-06-19 12:25     ` Frank Atanassow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lmmp6ckf.dlv@wanadoo.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).