novice's notes on learning OCaml

"Richard Underwood/Uhtenwoldt" <[email protected]>
Newsgroups gmane.culture.people.kragen.discuss
Message-ID <1172281271.3852@arch>
Kragen Javier Sitaker writes:
>Here's another, smaller-scale example.  My unit tests largely consist
>of code like this:
>
>    assert ([45; 50] = eval (Atom [45; 50]));
>
>Maybe at some point I would like to use floating-point for all my
>interpreter's values instead of integers.  I could imagine a language
>where I could retain compatibility with these tests by making Atom
>into a function that does the necessary conversion for the old tests;
>but that language is not OCaml, because in OCaml, your functions
>cannot begin with capital letters.

So, write your unit test as

    assert ([45; 50] = eval (atom [45; 50]));
    atom x = Atom x

Or am I missing something basic?

>   A simpler syntax with fewer levels of precedence.  Maybe writing
>   OCaml in S-expressions would be going too far, or maybe not.
>   Clearly this would make it effectively a different language.

Do you know enough about Haskell to have a definite opinion about its
syntax?

(I think it is basically good though I would reduce the number of
levels of operator precedence a lot.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.