On Mon, Feb 25, 2013 at 07:18:46AM -0800, Sergei Steshenko wrote:
> > From: Gabriel Scherer <gabriel.scherer@...>
> >To: email@example.com
> >Sent: Monday, February 25, 2013 3:28 PM
> >Subject: Re: "ocaml_beginners":: comaring "apples" to "oranges" ?
> >It's ironic to see a high-level concept like "disjoint union" (or "variant
> >type") be explained in terms of "simple" terms like pointers and stuff.
> >Maybe you're a bit too clung on the low-level details of previous
> >programming languages that don't work like OCaml.
> >A value of the type
> >type foo =
> >| A of a
> >| B of b
> >is either of the form (A v), where (v) is a value of type (a), or (B v),
> >where (v) is a value of type (b). The equality between values of type (foo)
> >is defined by cases:
> >(A v = A v') holds when (v = v') (at type a)
> >(B v = B v') holds when (v = v') (at type b)
> >note that (A _ = B _), or (B _ = A _), never holds.
> >That's all you need to know. But as your mind has seemingly be corrupted by
> >too much C programming to think of programming language data as anything
> >else than vectors to void*, we can also phrase it that way: a value of a
> >variant type is compiled down to something like a struct whose first
> >component (after runtime-specific information) is the constructor (A, B,
> >etc.), and whose other components are the corresponding parameters ("C of
> >foo * bar" has two parameters). (But constant constructors with just
> >parameters are just integers.)
> My mind is even more corrupted than you think.
> I am a physicist by education (and my first programming language was Algol-60).
> I am also a VLSI designer and a VLSI verification engineer - with some
> knowledge of at least the basic ideas of formal verification (automated theorem
> proving if you like).
And now you want to have OCaml implemented in VHDL?
> But, anyway, the explanations I've got above the "That's all you need to know" is too much abstract for me.
Then you should either use Assembler,
or read introductional books on OCaml.
All the low level stuff that polluted your thinking
hinders you to grasp the concepts of OCaml and other functional
If you want to learn new things, you are welcome,
otherwise, OCaml is the wrong language for you.
It needs different thinking, and may take a whil until you get it.
But you seem to insist on what you have leaerned before, from
the imperative C-/Perl-world.
If you like your Perl stuff, use it.
if you want to grasp OCaml, you need to open your mind first.
And the only way to do that, is to stop using the old concepts
for explaining the new concepts.
They are incommensurable.
> And if we are talking about low level, some OCaml parts are written in assembly.
When you listen to music (if you do that at all),
do you listen to the music, or do you think about
quantumphysics, that explains how it is possible
that the sound of the musicioan reaches you?