caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
@ 2003-03-16  0:44 isaac gouy
  0 siblings, 0 replies; 16+ messages in thread
From: isaac gouy @ 2003-03-16  0:44 UTC (permalink / raw)
  To: caml-list

> I have been struggling to learn OCaml for
> over a month now

Let me recommend: The Little MLer.
http://www.ccs.neu.edu/home/matthias/BTML/

Mostly as an experienced programmer you can think
through the examples in your mind, or on paper.

If you want to run the SML examples, it includes a
recipe for translating them into OCaml (of course, it
would be better to have a separate version with thie
examples in OCaml, but...)


> to really learn O'Caml, you have to learn the core
> ideas of functional programming

For experienced procedural or oo programmers part of
the frustration is that we have been spoiled by the
mass of material that is available for procedural and
oo programming.

There are shelf-loads of books aimed at teaching
procedural programmers how to do OO programming
step-by-step (how to structure a problem to match OO):
deciding what objects should exist, deciding what
relationships should exist between them, ...

It's much more difficult to find material that aims to
teach procedural programmers or OO programmers, how to
do functional programming step-by-step.

best wishes, Isaac





__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

-------------------
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


^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <20030318093223.I30420@latour.inria.fr>]
* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
@ 2003-03-14  8:12 Sergey Goldgaber
  2003-03-14  9:51 ` Noel Welsh
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Sergey Goldgaber @ 2003-03-14  8:12 UTC (permalink / raw)
  To: Caml-list; +Cc: Graham Guttocks

Disclaimer:  Sorry about the long-windedness of this, but I think
good, intuitive tutorials are some of the most important things a
language needs in order to be successful.  So I thought I'd share
my experiences with learning OCaml in some detail.


Graham Guttocks <graham_guttocks@yahoo.co.nz> wrote:
>
> There seems to me clearly, a lack of a good, tutorial style,
> introductory book about OCaml in English.  Something akin to
> ``Programming Perl'' (as someone mentioned).
> 
> I'm talking to a publisher at Manning (http://www.manning.com) about
> the possibility of such a book.  They are intrigued, but would like
to
> see some indication that people are interested.
> 
> Would you like to see such a book?

Oh, god YES!!  

I have been struggling to learn OCaml for over a month now.  It
is, without a doubt, the hardest language I have ever tried to
learn, and in some ways makes assembly language look simple and
intuitive by comparison.

Now, I am not a novice at programming.  I have used computers
since 1980, I know: C, Perl, Assembly, Pascal, Visual Basic, shell
scripting, Logo, REXX, SQL, HTML.  Picking up most any of those
(except for assembly) was a breeze.  But learning OCaml, as it is
my first functional language, is painful (until I have an "aha"
moment, when I glimpse its elegance and power, and all the pain
seems worth it).

I have gone through Bruce Hauman's "Intorduction to Ocaml"
tutorial, Scott Smith's lecture notes, and Jason Hickey's
"Intorduction to the Objective Caml Programming Language".

I have also read through parts of the O'Reilly book, but it really
wasn't doing all that much for me.  Also, I really like to have a
physical book in front of me (such a large online volume is
uwieldy, and it's too much to print out).

Fortunately, I managed to find Guy Cousineau's and Michel Mauny's
"The Functional Approach to Programming" used and got that.  I
have been slowly and steadily making my way through that, and it
covers the language in quite a bit of detail and in a good
tutorial matter, and I am generally very happy with it.  However,
I think the presentation of the material could be even better.
Also, it only covers Caml Light, so I think that might become an
issue at some point.

Coming from a purely imperative background I found the following
concepts the biggest stumbling blocks in my attempts at learning
OCaml: functional style, recursion, type inference

Of the three, I would say that in all of the material I have read
only type inference is covered in any serious detail.  And even
there the focus could be stronger and the explanations better.

Recursion is usually glossed over, and assumed to be just the
natural way to accomplish tasks.  When being taught most
imperative languages one is taught the very basics of recursion,
but actual use is comparatively rare.

As recursion is the mainstay of functional programming I think it
needs to be covered in a much, much more detailed, step-by-step
manner.  And many relatively basic exercises (with answers and
especially explanations of the answers) that should be done before
attempting any of the more advanced and complex OCaml idioms.

In your average Ocaml tutorial functional style is also not really
emphasized or explained well (if at all).  Sure, functional style
is used in the examples, but rarely is any attention given as to
why you would want to do things this way.

As OCaml offers one the choice of using an imperative style,
that's what I find myself naturally gravitating towards when I
start coding on my own (as opposed to solving toy problems for the
exercises).  I have to stop and force myself to think: "now how can
I do this in a more functional style, perhaps using recursion?"  

The tutorials show you how functions can be passed as arguments,
but for me it is so much more natural to just pass around normal
variables and values to distinct functions, rather than create a
series of functions each of which calls the next while passing
functions around.  This practical aspect of the functional style
is rarely explained.  You are shown that problems _can_ be solved
this way, but not really shown _why_ they should be solved this
way rather than in an imperative manner, or how you can think of
these complex constructions yourself.

Too much is ready-made in these tutorials.  "Here's a
Y-Combinator", "this is how it works".  But how would you ever
think of a solution like that yourself?  And why would you want to
rather than implementing an imperative solution?  That's what is
needed.

I think something like a "C Programmer's Introduction to OCaml" or
"From C to OCaml" book would be really great.  It should assume no
previous experience with functional languages, and perhaps could
start by showing the OCaml equivalents of C constructs like for
loops.  That will somewhat simplify learning OCaml's "strange"
syntax.  You could continue by focusing on OCaml's imperative
aspects, so that C programmers will quickly feel comfortable
because they are on home turf.  And only then, in the intermediate
and advanced sections of the book should you cover the functional
aspects of the language, again with plenty of juxtapositions
between the imperative and functional styles, and exercises,
exercises, exercises.

As for the object oriented aspects of OCaml, I have no comment
yet.  I'm saving trying to learn that until I feel very
comfortable with the functional aspects of the language.

But if you get the rest, and slap a "friendly" cover on (but not
too friendly, or it will seem like a "toy" language), I think
you'll have a hit.


  --Sergey


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

-------------------
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


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-03-18  9:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-16  0:44 [Caml-list] poll - need for a good introductory OCaml book (LONG) isaac gouy
     [not found] <20030318093223.I30420@latour.inria.fr>
2003-03-18  9:47 ` Sergey Goldgaber
  -- strict thread matches above, loose matches on Subject: below --
2003-03-14  8:12 Sergey Goldgaber
2003-03-14  9:51 ` Noel Welsh
2003-03-14 10:36   ` Sergey Goldgaber
2003-03-14 10:47     ` Noel Welsh
2003-03-14 11:13       ` Sergey Goldgaber
2003-03-14 11:47         ` Noel Welsh
2003-03-14 12:59         ` Geoff Wozniak
2003-03-14 11:20     ` William Lovas
2003-03-14 11:38       ` MikhailFedotov
2003-03-14 12:16       ` Sergey Goldgaber
2003-03-14 18:57         ` Richard W.M. Jones
2003-03-14 14:17       ` Guido Kollerie
2003-03-14 14:52 ` Fred Yankowski
2003-03-14 17:24 ` Brian Hurt

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).