From: Pierre Weis <Pierre.Weis@inria.fr>
To: fran@reyes.somos.net
Cc: caml-list@inria.fr
Subject: Re: Seeking pratical tutorial or examples.
Date: Mon, 16 Oct 2000 09:49:23 +0200 (MET DST) [thread overview]
Message-ID: <200010160749.JAA21632@pauillac.inria.fr> (raw)
In-Reply-To: <200010160046.UAA57403@sanson.reyes.somos.net> from Francisco Reyes at "Oct 15, 100 08:52:25 pm"
> I have looked at the caml site, the hump and all I links I could
> find from the main site.
[...]
In my mind, it seems as if you have completely missed the FAQ of the
language ...
> Isn't there a code snippet/samples page?
>
> What I have tried so far are the intro on the Ocaml Manual, the
> "Functional Programming using Caml light" and "One hundred lines
> of Caml".
>
> Comments on the 3 sources I mentioned above:
> ** Ocaml Manual: The intro is not bad, except that for those of
> us coming from languages without a built in interactive system
> we may not be as interested to start with that. Why? because
> although great for learning it is of not much use unless we just
> want to try simple things. [...]
Bizarre: you do not want to start by simple things ?
If you do want to start by material that are not ``simple things'',
you definitely have to read the pretty good bunch of examples that is
generally refered to as ``the Objective Caml compiler''. It is not
interactive, it is great for learning, and in some cases definitively
not simple (I would suggest the following road-map: start with the
Objective Caml libraries (directories stdlib and otherlibs), then
bravely start reading the compiler sources: first the Yacc parser and
its associated lexer (directory parsing), then take a breath and read
the type-checker (directory typing), breath again and continue with
the pattern matching compiler (directory bytecomp), then breath a lot
and end with the delicious native code compiler (directory asmcomp)).
> I think the following order may be more benefitial to someone
> coming from languages such as C/pascal.
Excellent: you are exactly describing the order of presentation of the
FAQ, that has been intended for just that kind of people. The first
page of the FAQ for beginners, has the following items entries, in
that order:
* What is the syntax of the language ?
* What are the basic data structures ?
* Numbers: integers and floating point numbers.
* Characters
* Character strings
* Arrays
* Lists
* Booleans
* Nothing
* References
* Pairs
* Other data structures
* What are the basic control structures ?
* How to perform a test ?
* How to perform a case analysis ?
* How to perform a test within a case analysis ?
* How to write a loop ?
* How to exit form a loop ? (break, exit, abort, return ...)
* How to catch errors ?
* How to signal errors (raise exceptions) ?
* What are the predefined exceptions (errors) ?
* How to define a function ?
* How to define a procedure ?
> -Start by having something which shows a compiled program and a
> few basic statements (i.e. ask for name and then print hello
> <name>.
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#quellesyntaxe
> -Cover data types and show the functions to read them and
> display them. No fancy explanation about "channels" just give
> examples using print functions and whatever is used to read info
> into a variable.
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#donnees_de_base-eng.html
> -Loops and branching: "for" and "if"
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#controle_de_base-eng.html
While, match and exceptions are also covered.
> -Cover functions
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#function_definition
> -Basic file I/O
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#ios
Printing is also covered at:
http://pauillac.inria.fr/caml/FAQ/FAQ_DEBUTANT-eng.html#impression
> -String handling
http://pauillac.inria.fr/caml/FAQ/donnees_de_base-eng.html#strings
> -More advanced data structures/types: arrays, user defined data
> types, lists.
http://pauillac.inria.fr/caml/FAQ/donnees_de_base-eng.html#vects
http://pauillac.inria.fr/caml/FAQ/donnees_de_base-eng.html#lists
http://pauillac.inria.fr/caml/FAQ/qrg-eng.html
> -The interactive system
http://pauillac.inria.fr/caml/FAQ/
> And of course on all those steps start showing the user the way
> things are written in Ocaml and how things are called in it.
The same references, plus the Quick Reference Guide for Caml that
gives you the syntactic constructs along with examples:
http://pauillac.inria.fr/caml/FAQ/qrg-eng.html
> ** Functional Programming using Caml Light
> I am up to chapter 5 and I am yet to dream of how to actually
> write a complete program. Even after I jumped chapters ahead to
> chapter 9, Basic I/O, there are one line descriptions or trivial
> use of the fucntions, but I didn't even see a simple brief
> program to show all elements together. The document almost seems
> like reference material, except that it is too
> descriptive/narrative to be that.
Right. It is not a reference manual, although it describes a
type-checker and a compiler for (a subset of) Caml.
> ** One Hundred lines of Ocaml: This is enough to give a "taste"
> of the language, but far from been enough to start hacking.
Right, it just appears in the FAQ under the title:
A taste of Caml
> Have a missed a kinder/gentler tutorial somewhere?
May be the FAQ ?
> Somewhere on the caml site I saw a mention about a series of
> examples that come with the compiler. The FreeBSD port I got
> didn't have them and I was unable to find them on the web site
> (caml.inria.fr)
Those examples are written for Caml Light and burried from the book
``Le langage Caml''. I translated them into Objective Caml, but have
not linked them to the Caml web site, since there is no english
explanations on those examples (the book ``Le langage Caml'' has not
yet been translated into english).
> francisco
> Moderator of the Corporate BSD list
> http://www.egroups.com/group/BSD_Corporate
PS1: I hope you will find what you need in the FAQ. In any case,
please let me know if you have some addition to suggest to the FAQ's
tutorial.
PS2: Also, when you are writing your first big Caml programs, don't
miss the very relevant Caml Programming Guide Lines:
http://pauillac.inria.fr/caml/FAQ/pgl-eng.html
that also gives some useful hints on how to program in Caml.
Pierre Weis
Moderator of the Caml list
http://pauillac.inria.fr/caml/FAQ/
next prev parent reply other threads:[~2000-10-16 7:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-14 15:59 OCaml sync tool for Rex organizer bcpierce
2000-10-16 0:52 ` Seeking pratical tutorial or examples Francisco Reyes
2000-10-16 5:42 ` Alan Schmitt
2000-10-16 11:20 ` Francisco Reyes
2000-10-16 7:49 ` Pierre Weis [this message]
2000-10-16 17:57 ` Chris Hecker
2000-10-17 17:40 ` Stefan Monnier
2000-10-18 5:52 ` Francisco Reyes
2000-10-18 7:20 ` Chris Hecker
2000-10-18 13:31 ` Stephan Houben
2000-10-16 21:46 Brent Fulgham
2000-10-17 10:10 ` Francisco Reyes
2000-10-17 17:51 ` Chris Hecker
2000-10-18 5:58 ` Francisco Reyes
2000-10-17 19:21 Brent Fulgham
[not found] <20001019101803A.garrigue@kurims.kyoto-u.ac.jp>
2000-10-19 19:02 ` Francisco Reyes
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=200010160749.JAA21632@pauillac.inria.fr \
--to=pierre.weis@inria.fr \
--cc=caml-list@inria.fr \
--cc=fran@reyes.somos.net \
/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