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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14  8:12 [Caml-list] poll - need for a good introductory OCaml book (LONG) Sergey Goldgaber
@ 2003-03-14  9:51 ` Noel Welsh
  2003-03-14 10:36   ` Sergey Goldgaber
  2003-03-14 14:52 ` Fred Yankowski
  2003-03-14 17:24 ` Brian Hurt
  2 siblings, 1 reply; 16+ messages in thread
From: Noel Welsh @ 2003-03-14  9:51 UTC (permalink / raw)
  To: Sergey Goldgaber, Caml-list

--- Sergey Goldgaber <sgoldgaber@yahoo.com> wrote:
> 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

The PLT people has done a lot of work on teaching
Scheme (think of it as dynamically typed O'Caml ;-) to
beginner programmers.  I've run some courses teaching
Scheme to programmers with a lot of Java experience
but little FPL experience and it has gone very well. 
I recommend that anyone considering writing an
introductory book on O'Caml take a look at their work:

  http://htdp.org/  is the "how to program" textbook
  http://htus.org/  is the "how to do useful things"
companion (in progress)
  http://teachscheme.org/ is the project

Whilst HtDP doesn't go far enough for the type of book
people on this list are talking about the basic
approach to teaching is well worth imitating.  It's
also worth looking at for anyone trying to learn
O'Caml (don't suffer from Not Invented Here syndrome!)

Noel

__________________________________________________
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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  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:20     ` William Lovas
  0 siblings, 2 replies; 16+ messages in thread
From: Sergey Goldgaber @ 2003-03-14 10:36 UTC (permalink / raw)
  To: Noel Welsh, Caml-list

--- Noel Welsh <noelwelsh@yahoo.com> wrote:
>
> The PLT people has done a lot of work on teaching
> Scheme (think of it as dynamically typed O'Caml ;-) to
> beginner programmers.

How would you say it compares to the SICP?  I've had that highly
recommended to me, and bought an old (1986) copy.  It seems
alright to me, but shares a weaknes (in my eyes) with most OCaml
tutorials in that it's heavily math based.

That's something that I should have mentioned in my previous
email: that the last math class I took must have been fifteen
years ago.  So tutorials that deal mostly with math are definately
a turn off.

Someone here mentioned "Programming Perl".  The earlier, Perl 4
version, was what I'd consider a tutorial.  It wasn't at all math
heavy and was very practical.  "The Perl Cookbook" is another
amazing book that the OCaml community would do well to emulate.
It contains tons of cookie-cutter code and explanations to common
problems.  Sure, it encourages a kind of "paint by numbers"
approach to programming, but you really learn a lot by seeing and
analyzing the solutions.

Anyway, back to the SICP.  I'm slowly going through it, and I've
actually found 20hrs of videotaped classes by the authors
themselves for free download at:

http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/

which is really great.  But the downside is that they use Lisp,
and that means that I have to learn yet another language.  I've
also heard that there are some good books on functional
programming that focus on Haskell.  But again, that's yet another
language.

Now, it's probably the case that once I know one functional
language others will be easy to pick up.  But why should I have to
learn two languages if I'm really only going to be focussing on
one of them?  One of them will likely go to waste (along with the
tons of other languages I've already learned).

This is why it would be great if the perfect tutorial already
existed that focused on OCaml, because that's the language I've
chosen.  I know it's a lot to ask, and there is already a good
deal of good documentation and tutorials out there.  But not on
the really basic level.  So it still remains an issue.


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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  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:20     ` William Lovas
  1 sibling, 1 reply; 16+ messages in thread
From: Noel Welsh @ 2003-03-14 10:47 UTC (permalink / raw)
  To: Sergey Goldgaber, Caml-list

--- Sergey Goldgaber <sgoldgaber@yahoo.com> wrote:
> How would you say it compares to the SICP?

SICP is an excellent book that touches on just about
every field of computer science and I also highly
recommend it, but it isn't the best way to learn
programming.  The PLT folk have written their own
critique of SICP

http://people.cs.uchicago.edu/~robby/publications/papers/htdp-sicp-fdpe2002.pdf

which gives some of the background to their own work
with How to Design Programs.

> Someone here mentioned "Programming Perl".  The
> earlier, Perl 4
> version, was what I'd consider a tutorial.  It
> wasn't at all math
> heavy and was very practical.  "The Perl Cookbook"
> is another
> amazing book 

I agree that these are both good practical books. 
Neither SICP or HtDP have the same aim so it would be
wrong to compare them.  If you after "The O'Caml
Cookbook" neither SICP or HtDP will get you any
further along that goal.  On the other hand, if you
want to think more in a functional style they help.

> But the downside is that they use Lisp,
> and that means that I have to learn yet another
> language. 

The Scheme dialect actually, but anyway...  I think
its well worth learning Scheme.  In many ways O'Caml
is a statically Scheme, with somewhat different
syntax.

Noel

__________________________________________________
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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  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
  0 siblings, 2 replies; 16+ messages in thread
From: Sergey Goldgaber @ 2003-03-14 11:13 UTC (permalink / raw)
  To: Noel Welsh, Caml-list

--- Noel Welsh <noelwelsh@yahoo.com> wrote:
>
> --- Sergey Goldgaber <sgoldgaber@yahoo.com> wrote:
>
> > How would you say it compares to the SICP?
> 
> SICP is an excellent book that touches on just about
> every field of computer science and I also highly
> recommend it, but it isn't the best way to learn
> programming.  The PLT folk have written their own
> critique of SICP
> 
>
http://people.cs.uchicago.edu/~robby/publications/papers/htdp-sicp-fdpe2002.pdf
> 
> which gives some of the background to their own work
> with How to Design Programs.

Thanks again.  I am downloading it now.

> I agree that these are both good practical books. 
> Neither SICP or HtDP have the same aim so it would be
> wrong to compare them.  If you after "The O'Caml
> Cookbook" neither SICP or HtDP will get you any
> further along that goal.

No, no.  That was really a tangent.  It would _also_ be
great to have an OCaml cookbook.  But, really, learning
how to program OCaml well is of primary concern.

> On the other hand, if you
> want to think more in a functional style they help.

Excellent.  That is what I'm after.

> > But the downside is that they use Lisp,
> > and that means that I have to learn yet another
> > language. 
> 
> The Scheme dialect actually, but anyway...

Sorry I was under the mistaken impression that the first edition
of the book used plain old Lisp, with only later editions using
Scheme.

> I think its well worth learning Scheme.  In many ways O'Caml
> is a statically Scheme, with somewhat different
> syntax.

Yes, I have heard great things about both Lisp and Scheme.
And I would love to learn them, along with Haskell, Erlang,
and Prolog (which I have also heard great things about).
But there are only so many hours in the day.  And right now
my focus is on OCaml.  If I absolutely have to learn another
language in order to master the functional style then I will,
but I would much rather were I able to kill two birds with one
stone and master the functional style just with OCaml, and move
on to other languages at my leisure.

Thank you for your help and recommendations,


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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 10:36   ` Sergey Goldgaber
  2003-03-14 10:47     ` Noel Welsh
@ 2003-03-14 11:20     ` William Lovas
  2003-03-14 11:38       ` MikhailFedotov
                         ` (2 more replies)
  1 sibling, 3 replies; 16+ messages in thread
From: William Lovas @ 2003-03-14 11:20 UTC (permalink / raw)
  To: Caml-list

On Fri, Mar 14, 2003 at 02:36:26AM -0800, Sergey Goldgaber wrote:
> Now, it's probably the case that once I know one functional
> language others will be easy to pick up.  But why should I have to
> learn two languages if I'm really only going to be focussing on
> one of them?  One of them will likely go to waste (along with the
> tons of other languages I've already learned).

What do you mean by "go to waste"?  If learning language B was the
key factor in your learning of language A, did language B really go
to waste?

I know you've heard this before, but let me restate it again in this
context: to really learn O'Caml, you have to learn the core ideas of
functional programming, and these core ideas are nearly identical in
all functional programming languages.

So if you happen to find the perfect beginner's Haskell tutorial out
there, don't fret -- have a look!  You'll have to learn a bit of new
syntax here and there, but when you come to understand O'Caml -- and
i mean *really* understand O'Caml -- it will be more than worth your
while.

[things get pretty meta after this point -- reader beware.]

Let me go out on a limb here and say that everytime we learn something
new, we do so by association with something we already know.  That's
why once you know one conventional programming language, it's easy to
pick up another.  That's also why so many programming language tutorials
look alike -- the author hopes to leverage your implicit knowledge of
the subject to teach you his particular instance.  The reason O'Caml
is hard to learn -- and the reason it has no tutorial similar to more
conventional programming languages' -- is that it's fundamentally
different in a non-trivial way: it strongly encourages the functional
style of programming.

Unfortunately for O'Caml's popularity, people who want to learn O'Caml
have to, in essence, re-learn programming, because the basic concepts
of functional programming do not map cleanly onto the basic concepts of
typical imperative programming.  So far, O'Caml has survived through a
vociferous userbase trying to convince people that the effort invested
is *worth it*, because functional programming is fundamentally *better*
(in some sense) than conventional imperative programming.  (Well, more
than just that *grin*, but it helps, i'm sure.)

Maybe i'm being too idealistic here, but i think a "perfect" tutorial
for O'Caml should focus on the ways it's different from other programming
languages, not the ways it's the same.  Perhaps such a tutorial (if it
doesn't exist already) could be prefaced by a number of "O'Caml for the
X programmer" hooks, for each conventional popular language X, just to
get programmers well-versed in X excited about O'Caml, at which point
they can segue into this "perfect" tutorial and learn what functional
programming is all about. :)

cheers,
William

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

* RE: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 11:20     ` William Lovas
@ 2003-03-14 11:38       ` MikhailFedotov
  2003-03-14 12:16       ` Sergey Goldgaber
  2003-03-14 14:17       ` Guido Kollerie
  2 siblings, 0 replies; 16+ messages in thread
From: MikhailFedotov @ 2003-03-14 11:38 UTC (permalink / raw)
  To: 'William Lovas', 'Caml-list'

Hi!

> Maybe i'm being too idealistic here, but i think a "perfect"
> tutorial for O'Caml should focus on the ways it's different
> from other programming languages, not the ways it's the same.

But it seems to me that the objective of such manual is
to distract the user from the language, not to attract. :)

If you tell the user that the language you are presenting
is very different from those languages that he is used
to respect, I'd bet that he will think you language is
worse. :-)

Any concentration of differences is very dangerous.

Mikhail


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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 11:13       ` Sergey Goldgaber
@ 2003-03-14 11:47         ` Noel Welsh
  2003-03-14 12:59         ` Geoff Wozniak
  1 sibling, 0 replies; 16+ messages in thread
From: Noel Welsh @ 2003-03-14 11:47 UTC (permalink / raw)
  To: Sergey Goldgaber, Caml-list

--- Sergey Goldgaber <sgoldgaber@yahoo.com> wrote:
> Sorry I was under the mistaken impression that the
> first edition
> of the book used plain old Lisp, with only later
> editions using
> Scheme.

Oh, that might be the case.  I've only ever looked at
the second edition (which is online, BTW:
http://mitpress.mit.edu/sicp/)

Noel

__________________________________________________
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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  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
  2 siblings, 1 reply; 16+ messages in thread
From: Sergey Goldgaber @ 2003-03-14 12:16 UTC (permalink / raw)
  To: William Lovas, Caml-list

--- William Lovas <wlovas@stwing.upenn.edu> wrote:
>
> What do you mean by "go to waste"?  If learning language B was the
> key factor in your learning of language A, did language B really go
> to waste?

Of course not.  It's not a complete waste that I once learned BASIC
and Logo.  But I haven't used them in twenty years and am probably
never going to use them again (well, I might use Logo again if I am
to teach programming, but that would really require relearning it
anyway).

> I know you've heard this before, but let me restate it again in this
> context: to really learn O'Caml, you have to learn the core ideas of
> functional programming, and these core ideas are nearly identical in
> all functional programming languages.

Yes.  I recognize that.  But why can't I learn those ideas in OCaml?
Why must I learn yet another language?

> So if you happen to find the perfect beginner's Haskell tutorial out
> there, don't fret -- have a look!  You'll have to learn a bit of new
> syntax here and there, but when you come to understand O'Caml -- and
> i mean *really* understand O'Caml -- it will be more than worth your
> while.

I am open to just such an approach.  In fact, I have been slowly
going through the SICP, which teaches Scheme, and am going to have a
look at Noel Welsh's recommendation as well.  Nonetheless, I know it
will take twice the time and effor to learn two languages than one
(well, maybe 1.5 times the effort), and one of them I'll likely
never use again once it's helped me to learn the one I'm really
after: OCaml (at this point).  So while it won't be a complete
waste, there will be at least some redundancy involved.

> Unfortunately for O'Caml's popularity, people who want to learn
> O'Caml have to, in essence, re-learn programming, because the
> basic concepts of functional programming do not map cleanly onto
> the basic concepts of typical imperative programming.

Yes, I think part of the reason is that functional programming is
"just different" from imperative programming.  However, an
additional reason may be that imperative programming is just
intuitively easier to grasp.  I have yet to hear about or from
people for whom a functional language was their first and they found
learning it as easy as do people who learn an imperative language as
their first language.  That is, unless they are already familiar
with Lambda calculus, which seems to figure greatly in functional
programming.

> Maybe i'm being too idealistic here, but i think a "perfect" tutorial
> for O'Caml should focus on the ways it's different from other
> programming languages, not the ways it's the same.

I think those distinctions are definately crucial to really
understanding OCaml.  In fact, it is precisely in those aspects of
the language which are very different from the imperative style that
I'm used to, that I am having the most trouble.  So a tuturial that
did a great job explaining and teaching those aspects would be
great.

But I'm not sure that those difficult aspects should be the very
first thing that a newbie should encounter.  I think a more fruitful
approach would be to show them first that the language can be useful
in very similar ways to ways they are used to (OCaml's imperative
features).  They will thus more quickly grasp the syntax, become
comfortable with the compiler/toplevel and should be able to slowly,
one at a time start to apply what they learn concerning the more
difficult aspects.

Not that any tutorial jumps right out and tries to teach the newbie
difficult idioms, but they usually leave the imperative aspects
of the language 'till later, which I think is a mistake.

I don't share your, implied, fear that someone might get turned off
if a tutorial starts off by showing only language features which
will be familiar to imperative language programmers.  If they're
learning OCaml then they know the language is different and they
know it has all of these magical features.  Just because they don't
learn the magic right away doesn't mean that they'll abandon the
quest.

In fact, I think they'll be heartened to see that the language is
learnable, in contrast to the reaction they'd likely have to a
trial-by-fire, throw them in the deep-end approach that would show
them the language is different, all right...  But it will be
frustrating, and they'll have a very hard time making sense of it,
and especially applying what they've learned.

> Perhaps such a tutorial (if it doesn't exist already) could be
> prefaced by a number of "O'Caml for the X programmer" hooks,
> for each conventional popular language X, just to
> get programmers well-versed in X excited about O'Caml, at which point
> they can segue into this "perfect" tutorial and learn what functional
> programming is all about. :)

Yes.  In fact, there's already a short "C++/Java programmer's
introduction to Objective Caml".  I don't know either language, so I
can't really comment on that.  But I think the important thing is to
go from imperative to functional style, rather than a particular
language.  I just picked C in my earlier post because it was so
widespread and most everyone will be able to understand if OCaml is
juxtaposed with it.


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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 11:13       ` Sergey Goldgaber
  2003-03-14 11:47         ` Noel Welsh
@ 2003-03-14 12:59         ` Geoff Wozniak
  1 sibling, 0 replies; 16+ messages in thread
From: Geoff Wozniak @ 2003-03-14 12:59 UTC (permalink / raw)
  To: Caml-list

Sergey Goldgaber writes:
 > 
 > Yes, I have heard great things about both Lisp and Scheme.  And I would
 > love to learn them, along with Haskell, Erlang, and Prolog (which I have
 > also heard great things about).  But there are only so many hours in the
 > day.  And right now my focus is on OCaml.

As a former imperative style programmer converted to functional, I should
tell you that once I learned [*] Scheme, picking up any other functional
language was really, really easy.  In fact, the only languages I've had to
spend real time learning since Scheme have been Aldor (getting used to the
type system takes a little time) and Prolog (getting used to relations
instead of functions).

Trust me, if you pick up one functional langauge, picking up another is not
difficult.

[*] By "learned" I mean I can interpret the syntax and I understand most of
the semantics of the language.  I do not mean that I have learned all the
library functions.  That is a different matter.

-- 
Geoff(rey) Wozniak, PhD Candidate
University of Western Ontario
Computer Science Department
London, Ontario, Canada
http://wozniak.ca/

He who knows best knows how little he knows.
                             -- Benjamin Franklin

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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 11:20     ` William Lovas
  2003-03-14 11:38       ` MikhailFedotov
  2003-03-14 12:16       ` Sergey Goldgaber
@ 2003-03-14 14:17       ` Guido Kollerie
  2 siblings, 0 replies; 16+ messages in thread
From: Guido Kollerie @ 2003-03-14 14:17 UTC (permalink / raw)
  To: Caml-list

[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

On Fri, Mar 14, 2003 at 06:20:37AM -0500, William Lovas wrote:

> I know you've heard this before, but let me restate it again in this
> context: to really learn O'Caml, you have to learn the core ideas of
> functional programming, and these core ideas are nearly identical in
> all functional programming languages.

I tend to agree.

> So if you happen to find the perfect beginner's Haskell tutorial out
> there, don't fret -- have a look!  You'll have to learn a bit of new
> syntax here and there, but when you come to understand O'Caml -- and
> i mean *really* understand O'Caml -- it will be more than worth your
> while.

With respect to this I can certainly recommend the book
"Functional Programming in Clean":

    http://www.cs.kun.nl/~clean/contents/Clean_Book/clean_book.html

or more specifically:

    ftp://ftp.cs.kun.nl/pub/Clean/papers/cleanbook/CleanBookI.pdf

Even though Clean might not be the language you're interested in,
this book will definitely help you understand some of the
functional programming concepts. Once you understand these
concepts you're essentially free to pick your functional
programming language of choice.

-- 
Guido

[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14  8:12 [Caml-list] poll - need for a good introductory OCaml book (LONG) Sergey Goldgaber
  2003-03-14  9:51 ` Noel Welsh
@ 2003-03-14 14:52 ` Fred Yankowski
  2003-03-14 17:24 ` Brian Hurt
  2 siblings, 0 replies; 16+ messages in thread
From: Fred Yankowski @ 2003-03-14 14:52 UTC (permalink / raw)
  Cc: Caml-list

On Fri, Mar 14, 2003 at 12:12:08AM -0800, Sergey Goldgaber wrote:
> I think something like a "C Programmer's Introduction to OCaml" or
> "From C to OCaml" book would be really great.

I found Ullman's "Elements of ML Programming" useful back when I was
learning Standard ML, in good part because he would deliberately
contrast ML programming features against C/imperative language
features.  That said, it's not like his book led to a flourishing of
standard ML among C programmers.

-- 
Fred Yankowski      fred@ontosys.com           tel: +1.630.879.1312
OntoSys, Inc	    PGP keyID: 7B449345        fax: +1.630.879.1370
www.ontosys.com     38W242 Deerpath Rd, Batavia, IL 60510-9461, USA

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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14  8:12 [Caml-list] poll - need for a good introductory OCaml book (LONG) Sergey Goldgaber
  2003-03-14  9:51 ` Noel Welsh
  2003-03-14 14:52 ` Fred Yankowski
@ 2003-03-14 17:24 ` Brian Hurt
  2 siblings, 0 replies; 16+ messages in thread
From: Brian Hurt @ 2003-03-14 17:24 UTC (permalink / raw)
  To: Sergey Goldgaber; +Cc: Caml-list, Graham Guttocks

On Fri, 14 Mar 2003, Sergey Goldgaber wrote:
> 
> 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.

Heh.

> 
> 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 note that none of the languages you list are Object Oriented either.  
You're learning a new paradigm.  Which is hard.  I actually got functional
programming *easier* than I got OO programming.  Not the least of which
was because I realized that it was a paradigm shift, and knew what that
meant (having gone through it once before, with OO).  I'd bet that 
learning Java or Smalltalk would be just as hard.

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

I don't view type inference as 'core' to functional programming.  You can 
do type inference on C, just most people don't.  It's easier to do it on 
functional programs than on imperitive programs, but you could quite 
easily write a functional program without type inference.

Functions as first class objects, partial evaluation, and recursion are 
central to functional programming, much like inheritance, virtual 
functions, and overloading are central to object oriented programming.

Let me shift the argument over a bit- from functional to object oriented
programming.  I've often heard the argument (from those who don't know OO,
and don't want to learn it) to the effect "why should I learn OO?  I can
do all this stuff in C if I want to.  I just generally don't want to."  
In a sense, they are correct- you *can* do everything Java does in C.  
It's just inconvient and error prone.  Java makes them easy, safe and
natural to use, and encourages you to use them.  At which point you
discover that using them a lot more is usefull.

A similiar argument applies to functional programming.  You can do 
functions as first-class values (function pointers), recursion, etc in an 
imperitive language as well.  It's just not as convient and safe.  

Here's the problem: in imperitive (and OO) languages, recursion is a hard 
concept.  Because it's not a natural concept in the model of computation 
that is implicitly being used.  You need to understand about stacks, stack 
frames, local variables being on stack frames, how side effects propogate, 
etc.  My high school Comp Sci AP class taught us the basics of Pascal in 
two weeks- and then we spent a solid month on recursion.  In imperitive 
languages, recursion isn't a trivial concept.

But if you change your model of computation, from turing-machine 
imperitive to lambda-calculus functional, most of these concepts become 
easy, even trivial.

Also, another thing I'd like to see- functional patterns.  Even language 
has design patterns.  Yes, the concept was pioneered by the OO people, but 
there are imperitive patterns, and functional patterns as well.

Brian


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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
  2003-03-14 12:16       ` Sergey Goldgaber
@ 2003-03-14 18:57         ` Richard W.M. Jones
  0 siblings, 0 replies; 16+ messages in thread
From: Richard W.M. Jones @ 2003-03-14 18:57 UTC (permalink / raw)
  Cc: Caml-list

On Fri, Mar 14, 2003 at 04:16:39AM -0800, Sergey Goldgaber wrote:
> Yes.  In fact, there's already a short "C++/Java programmer's
> introduction to Objective Caml".  I don't know either language, so I
> can't really comment on that.

http://caml.inria.fr/FAQ/stephan.html

It's actually a really great tutorial.

Shame there's not more of it really :-)

Rich.

-- 
Richard Jones, Red Hat Inc. (London, UK) http://www.redhat.com/software/ccm
http://www.annexia.org/ Freshmeat projects: http://freshmeat.net/users/rwmj
PTHRLIB is a library for writing small, efficient and fast servers in C.
HTTP, CGI, DBI, lightweight threads: http://www.annexia.org/freeware/pthrlib/

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

* Re: [Caml-list] poll - need for a good introductory OCaml book (LONG)
       [not found] <20030318093223.I30420@latour.inria.fr>
@ 2003-03-18  9:47 ` Sergey Goldgaber
  0 siblings, 0 replies; 16+ messages in thread
From: Sergey Goldgaber @ 2003-03-18  9:47 UTC (permalink / raw)
  To: Pierre Weis; +Cc: William Lovas, Caml-list

--- Pierre Weis <weis@latour.inria.fr> wrote:
> 
> Have you had a look to
> 
> http://pauillac.inria.fr/caml/Examples/oc/eng.html
> 
> There are there a lot of examples from simple to extremely advanced,
> from simple command-line a.out style to rather involved GUI
programming
> for an interactive Tetris game.
> 
> Some of the examples are equipped with their C equivalent for you to
> compare with, some other have both an imperative and recursive
versions, and
> still other examples have 4 or 5 implementations from simple to higly
> functional style.
> 
> I would be glad to incorporate other examples that you would think
> more appropriate for the beginners and/or comments or explanations
you
> could have.

Yes, many thanks for making this code available.  I can see that it
must have taken great dedication to write.

I looked at these examples at the start of my OCaml adventures, and
actually found the first few examples in the "basic" section to be
enormously useful, because  you kept at least a 1:1 ratio of comments
to lines of code, explaining even little things such as what
Sys.interactive meant and how to compile the code.  That was extemely
helpful.

However, after a few examples that practice quickly dropped to few and
sometimes virtually no comments (as with explode, reverse_stdin, or
solitaire program, for example).  This would be fine if the code was
accompanying a text where the code was explained in detail.  But, on
their own, without very heavy commenting explaining not only the syntax
but the algorithms, the examples are of limited use to someone who
doesn't already know OCaml or another functional language.

Now, however, after going through about four OCaml tutorials, playing
with some toy problems on my own, and having read a full quarter of the
Cousineau and Mauny text (and having followed through on thier
exercises), I think I may be ready to tackle the examples again, which
are making much more sense now then when I first started.

On a related note, I think it might be of benefit to mention things I
remember finding particularly confusing when I first started out:

 - Where semicolons are and are not used is very inconsitent in
OCaml...
   some statements are delimited by semicolons, others not...
   I was once very confused until someone pointed out that the last
statement
   in a block of code should not contain a semicolon (unlike the rest).
   Coming from a C background this took some getting used to.

 - Another confusing thing was why you needed an "in" section at all.
   I was used to execution starting as soon as you entered a function.

 - Of course, syntax was really a minor issue compared to getting used
to
   the functional style and recursion.  Especially how some algorithms
are
   arrived at and how they work.  I am still wrestling with these
issues.

Hope that helps.  And thanks again for your work!


  --Sergey


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.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

* 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

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-14  8:12 [Caml-list] poll - need for a good introductory OCaml book (LONG) 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
2003-03-16  0:44 isaac gouy
     [not found] <20030318093223.I30420@latour.inria.fr>
2003-03-18  9:47 ` Sergey Goldgaber

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