   OCaML
  I have to learn this language for one of my classes, anyone out there who knows it...can you please tell me why anyone would want to use this language over something like C? I realize the differance is that it''s a functional programming language compared to an imperative but I am working on an assignment and to retrieve the contents of the head of a list, this is the code necessary:let rec list_prod lst =   match lst with   [] -> 1 | x::xs -> x * (list_prod xs);;Perhaps they are showing us the hard way of doing this but as of now I can not understand why we are using this language. The class is compiler design and programming languages, and here I was hoping to write a scripting engine or something in C but apparently a good focus of the course is on this dumb language.--Andrew 
  Uh... that code returns the product of all the numbers in a list.Getting the contents of the head is just List.hd x;;;  I shoulda known better than to listen to some kid on the class news group :|--Andrew ;  Ask Toohrvyk why Ocaml is so great - he seems to love it. (Hint: he''s usually on #gamedev. )   ;quote:Original post by Assembler015   I have to learn this language for one of my classes, anyone out there who knows it...can you please tell me why anyone would want to use this language over something like C? I realize the differance is that it's a functional programming language compared to an imperative but I am working on an assignment and to retrieve the contents of the head of a list, this is the code necessary:let rec list_prod lst =   match lst with   [] -> 1 | x::xs -> x * (list_prod xs);;Perhaps they are showing us the hard way of doing this but as of now I can not understand why we are using this language. The class is compiler design and programming languages, and here I was hoping to write a scripting engine or something in C but apparently a good focus of the course is on this dumb language.--Andrew   I didn't develop games, but I use ocaml in several big projects.Ocaml is a high performance language. Ocaml isn't so far from the C performance. And it's better than C++ (especially with STL). You can look at the ``Doug Bagley's computer language shootout'' to compare benchmarks of the different languages on the different tests.http://www.bagley.org/~doug/shootout/craps.shtmlThis language is a strong-typed language.We had two teams, which worked for out projects.One of them used C/C++ language and we used ocaml.There were a lot of bugs in the C/C++ team. it's so hard to write right on these languages, C/C++ languages allow you to make mistakes, you need to look at the pointers and allocate and free many structures, but ocaml language does it automatically. I'm sure, if the ocaml program is compiled, whan it will work cool without any bugs. During writing the program on this language, you concentrate on the logic of the program only, you don't need to check pointers, buffers, sizes of structures, types and other different things. Ocaml language model doesn't allow you to make non logical mistakes. And it's so simple to write in ocaml, because you don't need to describe the types in the program.I really love this language.PS:  Your example is in the functional programming model, but you can rewrite it to the imperative model. Ocaml allows to use different types of programming model: functional, imperative and object.  There are many advantages in the functional model.PPS:  There are many functions on the C, look such as your function. You can write functional modelled programs on the C too.Best Regards,Alexander. [edited by - inv on February 19, 2004 1:45:30 PM];  Using C for anything other than as a platform independent assembly language is like playing FPS games with a thumbstick. ;quote:The class is compiler design and programming languages, and here I was hoping to write a scripting engine or something in C but apparently a good focus of the course is on this dumb language.Who is really dumb, the language, or the person with the inability to understand it? ;quote:Original post by twix  Getting the contents of the head is just List.hd x;; I doubt that''s the implementation the teacher had in mind when he gave the exercise. ;  Wow, never thought this post would be reawakened. Anyways, I did some of my own looking into the OCaml language and I concluded with my own opinions. quote:Using C for anything other than as a platform independent assembly language is like playing FPS games with a thumbstick. Obviously some people just don't like dealing with the nitty gritty details of the computer, which is fine. But my experience is the people that don't like dealing with them just don't understand them. More control over what happens in your program is a good thing, or so I would think. There are too many java whores out there who bitch and moan about having to 'free' the memory in C...or how it's not platform independant...get over it. Whatever though, I have yet to encounter one scenario C has not been able to accomplish and for me, that makes it a great (if not the best) language to program with.--Andrew   [edited by - Assembler015 on February 19, 2004 12:39:38 PM];quote:Obviously some people just don't like dealing with the nitty gritty details of the computer, which is fine. But my experience is the people that don't like dealing with them just don't understand them. Please describe your experiences more fully. Are they experiences in academia or in professional environments? I'll go out on a limb and guess you have no professional experience.What's the largest project you've worked on?quote: There are too many java whores out there who bitch and moan about having to 'free' the memory in C...or how it's not platform independant...get over it. Are you somehow suggesting that your professor is a Java whore because he used OCaML in your class?quote:Whatever though, I have yet to encounter one scenario C has not been able to accomplish and for me, that makes it a great (if not the best) language to program with.The more you learn the less you know. What was supposed to happen in your class was that you gained an appreciation for different ways of attacking a problem -not to galvinize your ignorance. I expect you will get a poor grade and blame it on the 'dumb professor' for choosing such a 'dumb language'.Then again, you could give us a pleasant suprise and turn out to be more open minded than that.   [edited by - flangazor on February 19, 2004 12:49:30 PM]