Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Erik de Castro Lopo <ocaml-erikd@mega-nerd.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Experiences with learning OCaml?
Date: 26 Nov 2004 00:46:57 +1100	[thread overview]
Message-ID: <1101390416.9291.37.camel@pelican.wigram> (raw)
In-Reply-To: <20041125225944.47a1d10a.ocaml-erikd@mega-nerd.com>

On Thu, 2004-11-25 at 22:59, Erik de Castro Lopo wrote:

> > Would doing this be difficult if one were sufficiently motivated? 
> 
> If you are reasonably familiar with languages as complex as C++ and
> Java, then Ocaml is definitely not too difficult but will require 
> you to develope some new ways of thinking about programming problems.

Functional programming is easy. There's a whole lot of
fuss about something simple.. :)

let decade = 
  let k = 10 in
  map (fun i -> i * k) [1;2;3;4]

I'm sure you'll understand the answer is 
the list of integers [10,20,30,40] once you grok the syntax,
and that example contains a higher order function map
(a function accepting a function as an argument) and
a lexically scoped anonymous function (fun i -> i * k)
which binds to the 'k' in scope. .. but these are just
features 'you always wanted in C++ anyhow' and got
sick of writing lame workarounds for ... :)

Once you have these features, your style of programming
will change naturally, even though Ocaml also has classes,
object, mutable varables, and imperative constructions too.

> Ocaml is a good choice.

Yes, because you can have quite a bit of fun solving
problems 'the usual imperative way' and then trying
to make it simpler.. which you'll find functional programming
helps with a lot.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net




  reply	other threads:[~2004-11-25 13:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-25 11:40 whenning
2004-11-25 11:59 ` [Caml-list] " Erik de Castro Lopo
2004-11-25 13:46   ` skaller [this message]
2004-11-25 12:28 ` chen yang
2004-11-25 13:52   ` Martin Berger
2004-11-25 13:36 ` Richard Jones
2004-11-25 20:39 ` Joshua D. Guttman
2004-11-25 20:56   ` Michael Vanier
2004-11-25 21:16     ` Danny Yoo
2004-11-26  0:16       ` Martin Berger
2004-11-26  0:15         ` Michael Walter
2004-11-26  0:47     ` SooHyoung Oh
2004-11-26  1:46       ` Michael Vanier
2004-11-26  3:09         ` SooHyoung Oh
2004-11-26  6:56 ` William Lovas

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=1101390416.9291.37.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=ocaml-erikd@mega-nerd.com \
    /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