<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/38d229d1475e914de083edc5b906873c"
  from="Matt Gushee &lt;mgushee@h...&gt;"
  author="Matt Gushee"
  date="2003-12-23T05:34:55"
  subject="Re: [Caml-list] Frustrated Beginner"
  prev="2003/12/a0b0531fb37dc533bd881d98808bed89"
  next="2003/12/4b03d6302b877c38d87a8293569cdb8e"
  prev-in-thread="2003/12/a0b0531fb37dc533bd881d98808bed89"
  next-in-thread="2003/12/c5acd59185f825661ce2c49a28f5d0a9"
  prev-thread="2003/12/4c6ae63cd6b1e8a8f33149859cfd695c"
  next-thread="2003/12/356d10902619a410f7549b83a9f58963"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/9ba2203dc9bd04094ddf59c3d0284deb"
  from="Tyler Eaves &lt;tyler@m...&gt;"
  author="Tyler Eaves"
  date="2003-12-23T04:00:52"
  subject="[Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/a0b0531fb37dc533bd881d98808bed89"
  from="jayanta nath &lt;jnath001@c...&gt;"
  author="jayanta nath"
  date="2003-12-23T04:19:23"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
<msg 
  url="2003/12/38d229d1475e914de083edc5b906873c"
  from="Matt Gushee &lt;mgushee@h...&gt;"
  author="Matt Gushee"
  date="2003-12-23T05:34:55"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/c5acd59185f825661ce2c49a28f5d0a9"
  from="Tyler Eaves &lt;tyler@m...&gt;"
  author="Tyler Eaves"
  date="2003-12-23T06:13:04"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/fe21fe7081ed319ea8db5f5750352671"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2003-12-23T06:21:18"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
<msg 
  url="2003/12/ee71502c878f5927a1b190f3a67ba83e"
  from="Michael Jeffrey Tucker &lt;mtucker@e...&gt;"
  author="Michael Jeffrey Tucker"
  date="2003-12-23T06:33:06"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/841e77b1ddce392241971f685edf5d8a"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-12-23T12:17:01"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/18dcbc2beccf1b644f6ab95457ee963f"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T20:29:52"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/5cd1c85734f3ce5ee910df85c3c7f2dc"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2003-12-23T06:38:09"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
<msg 
  url="2003/12/35fc0995ea1ae8ccceae6d350991db06"
  from="Matt Gushee &lt;mgushee@h...&gt;"
  author="Matt Gushee"
  date="2003-12-23T06:47:10"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/4b03d6302b877c38d87a8293569cdb8e"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T05:58:48"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/d0ac30fab0ff57144724f60d9ac5597e"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T06:53:39"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/cb5267240922f26dddcd0cc2ff382f2b"
  from="Tyler Eaves &lt;tyler@m...&gt;"
  author="Tyler Eaves"
  date="2003-12-23T07:23:39"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/4ea2bc69089f80a24ff1562317bbfd41"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T08:26:37"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/e8e0e512d3d35fafebac0f20d8832cba"
  from="Tom Murray &lt;yozhik@c...&gt;"
  author="Tom Murray"
  date="2003-12-23T06:20:47"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
<msg 
  url="2003/12/6d5f7b024ef3f697fac55342de6fce33"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-12-23T08:53:03"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/f895facc88274b349ffb2fd4d5b03bae"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-23T16:47:24"
  subject="[Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/c60a0e39a33234213fabb8de608e20a2"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T20:32:18"
  subject="Re: [Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/7511a52ffbb5f995bcc51cc1619bb2af"
  from="Eric Merritt &lt;cyberlync@y...&gt;"
  author="Eric Merritt"
  date="2003-12-23T21:03:47"
  subject="Re: [Caml-list] Ocaml syntax.">
</msg>
</msg>
<msg 
  url="2003/12/5f24e60286352a813888ef91b50b6578"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-12-23T21:52:47"
  subject="Re: [Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/eecce2c41acd3ffc1742dd3f9c2adf70"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-24T10:29:37"
  subject="Re: [Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/0e341a41b90d25333128238049ca470a"
  from="Peter Jolly &lt;peter@j...&gt;"
  author="Peter Jolly"
  date="2003-12-24T11:42:05"
  subject="Re: [Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/24be3928a72aa840fb93c85a339eb598"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-24T12:19:48"
  subject="Re: [Caml-list] Ocaml syntax.">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/9d57c140fb3d5f1ec182f811b5cfc0f7"
  from="dmitry grebeniuk &lt;gds-mlsts@m...&gt;"
  author="dmitry grebeniuk"
  date="2003-12-30T08:13:16"
  subject="Re: [Caml-list] Ocaml syntax.">
<msg 
  url="2003/12/e9066def8bab8a60fd712d2df0ec2bd1"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-30T17:48:52"
  subject="Re: [Caml-list] Ocaml syntax.">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/bec9c497ea5c688e3fead65fc14a0692"
  from="Samuel Lacas &lt;Samuel.Lacas@t...&gt;"
  author="Samuel Lacas"
  date="2003-12-23T10:25:48"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/9056423d13a1f0263d868ffcc335f22c"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T11:01:44"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/df4c7693f5aefbfc3ce2795223de537f"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-12-23T14:35:11"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/4614d0a74f49864cf1157d99ade90e8a"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T20:32:12"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/72d055fb36bbf52cf1f3596e7e17c798"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-23T16:07:46"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/48c1bdc28352b8ffaa6ab8cdc1029b85"
  from="Sven Luther &lt;sven.luther@w...&gt;"
  author="Sven Luther"
  date="2003-12-23T16:20:08"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/8aa1331578f5cd94bfcb4f5f0ff2a00e"
  from="David Brown &lt;caml-list@d...&gt;"
  author="David Brown"
  date="2003-12-23T16:52:37"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/48652a1c2e1c09264c1dedd530964ab3"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-12-23T20:33:28"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/74ed410e6ed55f048ca17bf40f5e9784"
  from="Issac Trotts &lt;ijtrotts@u...&gt;"
  author="Issac Trotts"
  date="2003-12-24T10:40:22"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/683eeee2d3a2d17bdea055ebdd10d273"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-12-23T17:36:13"
  subject="Re: [Caml-list] Frustrated Beginner">
<msg 
  url="2003/12/66a8d5c3e00e6eaf74c7910304840b3f"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-12-24T09:35:10"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/12/cf4340f158bb79341f0102a9dd0603e7"
  from="skaller &lt;skaller@o...&gt;"
  author="skaller"
  date="2003-12-24T09:49:57"
  subject="Re: [Caml-list] Frustrated Beginner">
</msg>
</msg>
</thread>

<contents>
On Mon, Dec 22, 2003 at 11:03:07PM -0500, Tyler Eaves wrote:
&gt; 
&gt; I'm a 19 yr old computer science student, been programming for perhaps
&gt; 10 years. ... 

Welcome! I'm at best an intermediate OCaml programmer, but I'll try to
make a helpful suggestion or two.

&gt; So why is O'Caml giving me so much trouble?

Do you have any previous experience with functional programming (FP), or
have you studied FP in school? If not, then you're learning both a new
syntax and a very different programming paradigm at once, so you should
expect a steep learning curve. But I think if you stick with it, after a
while it will all start to make sense, and you'll be glad you made the
effort.

&gt; I've been trying to pick it up for about a week now, read various
&gt; online tutorials.

Which ones? Personally, I have found David Matuszek's and Richard Jones'
tutorials to be the most helpful for learning fundamentals.

  http://www.csc.vill.edu/~dmatusze/resources/ocaml/ocaml.html
  http://www.merjis.com/richj/computers/ocaml/tutorial/

&gt; My biggest source of problems seems to be the syntax. I'm totally
&gt; confused as far as ; vs ;; vs nothing, ...

Yes, that is a bit tricky. You've undoubtedly read explanations of the
semicolons, but sometimes it helps if you get the same information again
in slightly different terms, so let me try:

  * A double semicolon ends a "sentence"--that is, it terminates a
    top-level construct such as a function definition--but not nested
    function definitions, because they're not "sentences," they're
    "phrases". 
    
    You can omit ;; in most cases, but I would suggest at first using 
    it everywhere it is allowed. When you omit the ;; and there is a 
    syntax error in your code, the compiler often goes many lines past
    the real trouble spot before it detects an error, so using ;;
    everywhere can narrow down your search.

  * The single semicolon is perhaps a bit harder to understand, but I
    think it helps to keep in mind that OCaml is basically a functional
    language, yet it also supports imperative programming. Being
    functional means that there are no statements per se. It's all about
    evaluating expressions, and *every* expression returns a value.
    However, there are expressions that are functionally equivalent to
    statements. In order to conform to the functional model, they have
    to return a value, but there is no useful value to return. So they
    return the unit value, '()'.

    Basically, whenever you are programming imperatively--when you have
    one of these pseudo-statements that return (), and when it this
    imperative phrase is not the final result of a function, you need to
    separate it from the following phrase with a single semicolon. A
    simple example:

      match foo with
      | None -&gt; print_endline "Nothing"; ""
      | Some x -&gt; print_endline x; x

    This expression returns a string, but before returning, you want to
    print a message. Printing functions, of course, return ().

Hope this helps a bit. Best of luck to you!
    
-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

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

</contents>

</message>

