OCamel, Oh what?

Started by
122 comments, last by GameDev.net 17 years, 11 months ago
Quote:Original post by Rebooted
Quote:Original post by jsgcdude
I'm interested to hear how someone with more experience would compare ocaml to lisp? Ocaml has no preprocessor, which I understand to be on of lisp strengths?

Lisp isn't really about functional programming, it's about a lot of things.

As for the preprocessor, Lisp/Scheme use macros which can manipulate code at compile time. It's much more advanced than C's preprocessor. OCaml has CamlP4 and an extension called MetaOCaml.


I'm not quite sure what your definition of compile time is for lisp, but I'd say that lisp macro's allow you to manipulate code at run time!. ie you can use macro's to dynamically generate your code the first time its executed or you could use the same macro to generate different code each time its executed depending on the parameters passed to the defmacro call.

Cheers
Chris
CheersChris
Advertisement
Quote:Original post by jsgcdude
I'm not quite sure what your definition of compile time is for lisp, but I'd say that lisp macro's allow you to manipulate code at run time!
Sorry, it's instinctive to say compile time when you are talking about metaprogramming. Obviously, Lisp often isn't even compiled [grin].

[rolleyes]
We, the members of the secret programmer's society, like to tell aspiring young programmers to learn esoteric languages like O'Caml and Lisp and Haskell (if we feel really sadistic, we'll even recommend scheme), because it makes them waste time learning stuff that is useless in the industry. This means more jobs for us, the initiated!
Quote:Original post by TrueTom
Someone has to mention the even more leet Haskell since it has some serious imperative programming style (you can create you own flow-control-structures, it has a workable solution for the IO problem but is still pure).


Serious imperative programming style? You mean functional? Also, you can really create your own flow control structures in any OO language or language which has first class functions (basically, any language that has something which is isomorphic to a lexical closure).

Quote:
Oh, and someone please get me some functional programming into C++ until 2009, thanks...


You can already do functional programming in C++, but it isn't as easy. Look into Boost and FC++.
Quote:Original post by Anonymous Poster
We, the members of the secret programmer's society, like to tell aspiring young programmers to learn esoteric languages like O'Caml and Lisp and Haskell (if we feel really sadistic, we'll even recommend scheme), because it makes them waste time learning stuff that is useless in the industry. This means more jobs for us, the initiated!


Why do you post anonymously?

Can't you stand up for your claims?
----------------------------

http://djoubert.co.uk
Quote:Original post by dawidjoubert
Quote:Original post by Anonymous Poster
We, the members of the secret programmer's society, like to tell aspiring young programmers to learn esoteric languages like O'Caml and Lisp and Haskell (if we feel really sadistic, we'll even recommend scheme), because it makes them waste time learning stuff that is useless in the industry. This means more jobs for us, the initiated!


Why do you post anonymously?


because I can

Quote:Original post by Anonymous Poster
We, the members of the secret programmer's society, like to tell aspiring young programmers to learn esoteric languages like O'Caml and Lisp and Haskell (if we feel really sadistic, we'll even recommend scheme), because it makes them waste time learning stuff that is useless in the industry. This means more jobs for us, the initiated!


Dude, I use it(lisp) in my day job, I'm one of maybe 3of us here who do but all serious developers I know use lisp atleast on a weekly basis, if only to customize emacs. YMMV though I suppose:)

Cheers
Chris
CheersChris
Quote:Original post by chollida1
Quote:Original post by Anonymous Poster
We, the members of the secret programmer's society, like to tell aspiring young programmers to learn esoteric languages like O'Caml and Lisp and Haskell (if we feel really sadistic, we'll even recommend scheme), because it makes them waste time learning stuff that is useless in the industry. This means more jobs for us, the initiated!


Dude, I use it(lisp) in my day job, I'm one of maybe 3of us here who do but all serious developers I know use lisp atleast on a weekly basis, if only to customize emacs. YMMV though I suppose:)

Cheers
Chris


Yep. So do many other people. What the AP posted appears to be basically flame-bait.
Quote:Original post by dawidjoubert
I Saw the raytrace comparison and I see OCaml is quite impressive however my concern is that the code they made using C++ does not need to be OO, c++ supports functional coding as well.


I wrote the C++ and OCaml implementations of the ray tracer (and several others). OO is the most elegant solution in C++ but it is clearly inferior to the ML solutions (both OCaml and SML).

C++ does not support functional programming in any meaningful sense. Closures are one of the most important constructs in functional programming languages and, for closures, you need automatic closure generation (i.e. the compiler must work out which variables are available within a closure, which C++ compilers do not) and you need garbage collection because closures can keep variables alive (C++ doesn't do this either).

Finally, the more succinct and faster ML family of languages come into their own on much bigger projects. In particular, ML helps when you simply don't have the man power to implement a project in C++. Also, the ray tracer doesn't demonstrate the much-faster development times offered by ML thanks to ML's additional static checking.

Regarding Lisp, depending upon your choice of applications you may find Lisp preferable. However, I think there are very few applications where Lisp is better than OCaml.

Cheers,
Jon.
Regarding efficiency of functional languages:
The disappointing thing, for me, was learning about writing efficient Haskell code. The resources I found suggest that you write your code and then gradually add hints until the compiler can remove all laziness. The disappointing part is that these hints usually make the code more imperative and less functional.

Regarding functional programming in C++:
Saying you can do functional programming in C++ sounds to me like saying you can do object oriented programming in C. They're both true, but the language doesn't come with many of the tools that a language designed for that style would have.

Regarding silliness:
I think "OCaml, Where Art Thou?" would've been a better title for this thread.

This topic is closed to new replies.

Advertisement