ICFP 2002 Contest Winners Announced 254
Georgwe Russell writes "The Winners have been announced at the official web site. Looks like OCaml and functional programming have won again, with the 3 member TAPLAS team. There is somewhat of an upset, though. Second place goes to 3-member team Radical TOO, whose entry was written in C! In the lightning round, the virtues of Python as a quick prototyping language were shown in the lightning division's winning entry by the OaSys one-man team. Does the skill of the programmer prevail over the limitations of the language and paradigm used, or is C nearly as good a language as OCaml?"
Yeah.. language is not matter much.. (Score:5, Interesting)
Most languages are functionally equivalent,
you can even have something like Alma
a program that translate a lot languages to a lot of other languages. It's fun to play with it!
Language doesn't matter, language CLASS matters (Score:2)
C is imperative, you have to tell the computer exactly what to do. OCaml is functional, you give the computer rules and then point it in the right direction. I don't believe alma will convert from one group to the other.
People who rate functional languages always site impressive examples like the guy who wrote a submarine control program in 40 lines of ML, where previously it was 40,000 lines of C.
The trouble is, that functional languages, while they may be more powerful, are much harder to write well in, generally taking you far longer to get to the finished state you want.
In this time-boxed challenge, I'm not surprised to see C come in as one of the winning entries. I think that if the time constraints were relaxed, though, you'd see nothing but OCaml, Gofer, ML etc etc.
Re:Language doesn't matter, language CLASS matters (Score:1)
You can experiment with Alma here [desnoix.com]
(Disclaimer: I am not sure that it can hold
Re:Language doesn't matter, language CLASS matters (Score:1)
They're *all* imperative!
Re:Language doesn't matter, language CLASS matters (Score:1)
Sql
Re:Language doesn't matter, language CLASS matters (Score:2)
Re:Language doesn't matter, language CLASS matters (Score:1)
Re:Language doesn't matter, language CLASS matters (Score:2)
And SQL is missing too... If you think about it for microsecond the idea of converting a normal language to or from SQL doesn't even begin to make sense...
Re:Language doesn't matter, language CLASS matters (Score:1)
Re:Language doesn't matter, language CLASS matters (Score:2)
As for converting into Lisp, I guess it must be possible to convert either way at the end of the day because they all come down to machine code... but i would imagine that the code produced by converting c to lisp is pretty far from the way normal lisp looks, or the way the designers intended it to be used
SQL as an LBA-complete language (Score:2)
SQL is not a turing-complete language
Neither is any other programming language in existence on a real machine. A Turing machine has an infinitely long memory. Real computers are called "linear bounded automata" (LBAs), which means a Turing machine with the modification that the memory is limited to a constant multiple of the size of the input, and trying to go off one end of the memory makes the head hit a brick wall. It's even possible to solve the halting problem on LBAs: just emulate two copies, one at double speed (tortoise/hare setup), and stop when the state and memory of both machines become identical, which means that the faster LBA has looped.
PL/SQL and its free clone PL/pgSQL are imperative languages that are just as LBA-complete as C or Scheme.
Re:Language doesn't matter, language CLASS matters (Score:2)
Yes, lisp is functional (Score:2)
Re:Language doesn't matter, language CLASS matters (Score:2)
Re:Language doesn't matter, language CLASS matters (Score:5, Informative)
That's not what "functional language" means. The magic of functional programming comes from the (sometimes typed) lambda calculus, in which functions can be passed as parameters. In this vein, we also have easier polymorphism (functions can take a type as a parameter) and fewer "side effects," which could mean fewer bugs.
See Why Functional Programming Matters [chalmers.se]. For the theoretically inclined, I enjoyed An Introduction to Polymorphic Lambda Calculus with Subtyping [vub.ac.be].
(Both links can be found on the pages I link to; I don't link to the articles because I don't know your document format of choice.)
Re:Language doesn't matter, language CLASS matters (Score:2)
I guess to people who know, my description sounds more like prolog than fp, but i still think it's a better way of describing to someone who's never seen a functional langauge before.
Re:Language doesn't matter, language CLASS matters (Score:3, Insightful)
And no, I don't think your description captured functional languages very well - as you say, it sounded more like Prolog. Besides, the "rule-based" appearance of some functional languages (notably Haskell & the ML family) is really mostly syntactic sugar. Scheme, which is much closer to the pure lambda calculus on which most functional languages are based, doesn't have such a rule-based appearance.
Are you sure you don't have it backward? (Score:5, Informative)
But don't take my word for it:
Re:Are you sure you don't have it backward? (Score:2, Informative)
- one situation in which the language was specifically written for the task at hand. I give you the fact that you get a productivity enhancement if your language is tailored to your problem (probably regardless of whether it's functional or not).
- one situation which doesn't mention the speed to code at all (the microcode one)
- 2 different 'prototype' experiments.
In case you missed it first time around,
The trouble is, that functional languages, while they may be more powerful, are much harder to write well in, generally taking you far longer to get to the finished state you want.
Prototype != working code. Case made.
Re:Language doesn't matter, language CLASS matters (Score:2)
If the programs couldn't be run on imperative machines, what would be the point in writing programs in 'em.
Re:Language doesn't matter, language CLASS matters (Score:2)
Re:Language doesn't matter, language CLASS matters (Score:3, Interesting)
these guys can write good code in _any_ language (he was a scheme hacker who was busy optimising HAIRY C gc code), but are attracted to functional langs because such langs directly capture the abstractions these guys use.
so, to paint with a broad brush, functional languages aren't nec. better than imperative, but the functional paradigm (abstraction, genericity, focussing on data rather than process) IS.
Re:Language doesn't matter, language CLASS matters (Score:1)
I doubt it. Programmers are lazy :).
The majority of programmers can't write decent implementations of common data structures or algorithms. Even though I can, I'd rather have a large library to use so I can focus on the stuff that's actually unique to the problem.
C has very few standard high level functions. It's really tedious to program complex applications unless you use extra libraries.
-Kevin
Re:Language doesn't matter, language CLASS matters (Score:3, Informative)
Re:Yeah.. language is not matter much.. (Score:1)
Re:Yeah.. language is not matter much.. (Score:1)
methodology differs, and it matters (Score:2, Redundant)
Languages like C, C++, Java, C#, Ada, Eiffel, VisualBasic, etc., are indeed largely interchangeable, and you can all approach them with the same mainstream object-oriented design methodology.
But just because you are a proficient Java or Eiffel programmer and object-oriented designer doesn't mean that you have a clue about how to write effective code in a functional programming language. You can design functional programs like object-oriented programs, and the result will work, but it will be as tedious as if you had written the code in an object-oriented language to begin with.
To take advantage of functional languages (or, more generally, other non-object-oriented languages), you have to unlearn pretty much everything you learned about object-oriented design.
It's quite analogous to the procedural/object-oriented transition: lots of people believed that they could write object oriented code because their procedural coding styles kind of kept working, but they were missing the point. You are missing the point, too, if you think that functional programming is just a small variation of what you are already doing.
Furthermore, functional programming is very hard to simulate well in object-oriented languages--most attempts end up not being able to provide the invariants and encapsulation that functional programming guarantees automatically, and without the type systems of functional programming languages, many interesting usages are just too complex to type.
Re:methodology differs, and it matters (Score:2)
The danger with getting to know FP through multi-paradigm languages (Lisp, Oz, etc.) is that people may stick with their familiar paradigms. But if you want a good multi-paradigm FPL, OCaml seems like the best choice right now.
Re:methodology differs, and it matters (Score:2)
O'Reilly has a book available on-line, Developing Applications with O'Caml [inria.fr].
Re:Egads... (Score:1)
Yep.. I apologize... I am NOT English native speaker. Sorry.
When I think in Russian, and try to speak/write in chat about computer stuff, I also make a lot of mistakes...
What's wrong with C? (Score:2, Informative)
Re:What's wrong with C? (Score:4, Informative)
Of course an excellent C programmer, with excellent tools can prototype fast, but they have to have more domain knowledge and a more intimate understanding of their language.
From the contest web site.
"correctness, algorithmic cleverness, and performance will matter"
Re:What's wrong with C? (Score:1)
Better to go with what you know than waste time on the stilted syntax of some crazy moonman language that could theoretically do it with less typing.
It's the Algorithm, Stupid (Score:5, Insightful)
Re:It's the Algorithm, Stupid (Score:1)
That is flamebait horse shit! There is no clear evidence that strong typechecking "allows programmer to focus" more.
IMO, it is subjective. Different people work better under different language concepts. What F's Joe up may not F Jenny up, etc. I have seen many 100+ message debates on this topic, and there is no objective victory for either side of the typing debate. I just know what works better for me. I grew up on strong-typed languages, but now prefer dynamic or type-free languages.
I guess I'm not a real geek afterall (Score:4, Funny)
Re:I guess I'm not a real geek afterall (Score:2, Funny)
Re:I guess I'm not a real geek afterall (Score:1)
What about #3-160? (Score:3, Informative)
Radical Too (runner-up) was kind enough to post their source (after the competition is over, there isn't much reason not to).
But what about me (Aqua Team Hunger Farce)?
Links to source/explanations of many entries can be found on the ICFP site Here [ogi.edu]
My entry is listed as well. The order of listing is just when people submitted links to writeups, not the winning order.
Re:What about #3-160? (Score:1)
From what I saw, it went like this . . . (Score:4, Informative)
Thinking in OCaml (Score:1)
Re:Thinking in OCaml (Score:2, Funny)
That's about what it takes to put one in the frame of mind for it
C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:3, Interesting)
Don't get me wrong; C is great for the kernel and other code that needs to be machine-layer portable. But with the gnome panel at 5 mb, apparently no one cares about writing tight code anymore. So if its not going to be small and fast, it might as well be secure and reliable.
Which C will never be.
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2, Insightful)
-Kevin
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
It does depend on the skill of the programmer... that's my point. You are trusting more people than you realize to have written good software that could intentionally or accidentally compromise your precious data.
Java and other GC languages aren't magical, they don't remove buffers. All they do is what any decent system should: check the buffers in system code. You're not going to break Java programs just because they are running on something that was written in C, because the checks are done and tested.
Not many people argue that we should still be using assembler. The shift is clear. It began with C taking over the app market, then all of a sudden a bunch of freaky students decided they wanted to write an OS for gaming, and they didn't want to bother with all that low-level assembler crap. I really don't see C living much longer as a popular language. Laugh now, but it happened before, and history repeats itself, and for good reason this time. I wouldn't be suprised if cracking and terrorism speed it up.
The most likely place where you'll start seeing Java (only because it's the most developed and easy to use of the GC languages) programs crop up are everything from shells to window managers. Then the server processes will be taken over by Java counterparts. A Java DNS server and a Java MTA will be made by someone tired of being hacked every other week through bind and sendmail. It will be easy to administrate because it will have a nice GUI. Then the hackers will pick on another C project.
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
One day an operating system will be implemented as a set of APIs on a VM consisting of a very small set of machine-dependent code, but not yet.
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
If more software were written in type-safe languages, we wouldn't have so damn many buffer overrun security holes popping up all the time. It's possible to write secure software in C, but the language doesn't help you do it. C isn't a high-level language, it's a portable assembler. Writing large pieces of software in C is madness.
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
Well, solaris is written in C++ (Score:3, Funny)
A huge program in C++ will probably have tons of buffer overflows to exploit. A Large Java program will have ZERO overflows.
It's like comparing a hand grenade to an orange. Both can be handled safely, but an orange is just not going to blow up, no matter what you do, while the hand grenade has an increasing chance of exploding the more you fiddle with it.
Re:C is a gr34t langu4g3! P1eese k33p u5ing it!!! (Score:2)
Ability, luck, and language -- in that order (Score:5, Informative)
Simply put, programming languages are tools. Some tools make certain jobs easier than others, but tools only go so far. The rest is up to the programmer.
In the case of this year's ICFP contest, Team Radical Too did well because they had a good strategy that ultimately fared well in judging. Their robot performs a semi-exhaustive simulation of the possible moves up to a certain degree and then chooses the best move based on the simulation results. (It's a cool approach, and the source code is worth a read.)
It's a compute-intensive strategy, and my guess is that they selected selected C as their implementation language for this reason. They made the decision to sacrifice the high-level flexibility that other languages provide in order to have C's low-level control over how CPU cycles and memory are consumed.
Oh, and then there's luck
Despite how much we like to argue about programming ability and choice of programming language -- and competitions are perfect fuel for this particular fire -- we shouldn't read too much into the results of programming competitions. Luck plays as large role as any.
In the case of the 2002 ICFP Programming Contest, for example, I happen to know that several of the robots, including Team Radical Too's robot, will unwittingly commit suicide in situations where they have the opportunity to push another robot into lethal water that spans more than two board cells. In this situation, the attacking robot will push its victim into the water, killing it. The victim, although dead, appears on the game board the next turn (and is removed from the game on the turn after that). However, the attacking robot's logic fails to account for the fact that dead robots can remain on the game board for a turn before they are removed by the game server. It considers any robot on the game board to be alive -- including the now-dead victim, floating in its watery grave -- and hence fair game for attack. Seeing that there is water beyond the now-dead victim, the attacking bot will try to push it again, thus stepping into lethal water itself and effectively committing suicide. Oops.
Luckily, the judges didn't have any wide spans of water in the map used for the final showdown.
Indeed, chance happeneth to them all.
Re:Ability, luck, and language -- in that order (Score:1)
I think it would mean something if people with high programming ability always reliably selected certain languages to code in, and rejected others -- don't you? Maybe they pick certain languages because they are easier or better to program in.
If they didn't, if instead they always picked the difficult language because they wanted to prove to the world that they were awesome enough to handle that language, then there is always the possibility that some dumb programmer with an ordinary language like C will come along and... wait a minute...
More lines in C, but same outcome. (Score:5, Interesting)
What's the difference? The amount of lines you need to write to get the same result.
It therefore goes that the more lines you need to write to get the same result, the more control you get over the program and the computer on which it is running. This means that programs in C can control the computer in better ways than programs written in Perl or Python.
A lot of programmers, like C programmers, think that C, much like Ada, a language to program, in on problems such as objective and the logical ones. An interesting example is the difference between Visual Basic and Visual C++.
In Visual C++, to open a window takes about 104 lines of code if you estimate the number without doing any research like myself. In Visual Basic, you can open a window just by creating a new project and hitting 'Run'. It's easy, and that's why it works.
This is primarily true in the first instance, since there is proof that indicates such, although there is no evidence of this to suggest quasi-otherwise.
Lines it is! (Score:4, Insightful)
Visual Basic is a very nice language for coding GUI-based applications. Newer versions have increased speed and performance such that there's not really a difference (exempting the included DLL's) between a standard office-type app made in VB and one in C++. If you want to get complicated and rip into the windows API, then you're probably doing something that may require C++, but VB often even handles this nicely. It interfaces much more nicely with the C-based DLL's than it used to in the past.
My biggest peeve is the syntactical differences in compative operators and math. There was a time when I love VB, but now I truly hate having to do a "myvar = myvar+1", or the fact that you can't do something like "var1=var2+var3" (in VB that would give a boolean).
In arguement for VC++, the wizards can handle a lot of the windowing/GUI stuff for you. I think that if if gave you some nice understandable error messages when you screwed up things might be a lot nicer. (it sucks when you get an ambiguous error message on line 2023 caused by a mistake on line 101).
Since I've learned C++, I prefer it when possible. I have no huge qualms about writing a GUI in VB, or even a hybrid project with C++ DLL's linked to my VB GUI's. Every coder has their place. Just because one can program C and Fortran doesn't make them any better than a VB programmer. In a timed-trial for a small GUI app, the VB programmer would likely stomp the C progammer.
If only MS could program better error messages... Error on line 342: unknown thingamabobber executing blingconfangler - phorm
Visual basic does not *SIMPLIFY* the coding! (Score:2)
In contrast with languages like Scheme, Java, etc, which really do require less code to do anything visual basically actually impedes what you do, due to the seriously lacking language features. Classes can be done Via COM, but good luck if you want to do something like polymorphism, or passing functions around or whatever.
I've coded in VB, and trust me, the reason people don't like it is because it's weak and it sucks. I constantly found myself smashing up against the limitations of the language. Things that would be easy to do in java or even C++ were impossible from a practical standpoint in VB.
Of course, things may have changed some in VB.net. But considering the fact that VB.net isn't even compatible with pervious VBs, I couldn't really care.
Oh yeah... (Score:2)
Windows/Linux Socket samples/instructions? (Score:2)
What do you use as a reference for this? I haven't coded any C-type stuff for linux (just Perl scripts) yet but I would be most interested in getting started. I so any good reference-material would be good, particularly in reference to sockets. I suppose I could also code something like this in Perl as well?
I've been told that sockets on linux behave in a similar way to those in windows, so perhaps it won't be too large a gap to bridge in my case, just need some samples to get me started.
There are 11 types of people. Those who understand binary, those who do, and those laugh at those who do - phorm
That is so much bullshit. (Score:2)
I remember getting into a debate with some kids about this in highschool. The next day, I'd produced a program that would bounce a ball around in a window in 30 lines of code.
By "squishing" the code down (although, with only one semicolon per line, outside of for loops) I was able to get it down to 23 lines. Keep in mind I was in highschool.
Anyway, if you want to see this for yourself, the source is up at http://autopr0n.com/23lines.cpp [autopr0n.com], and the complete VC5 (IIRC) is at http://autopr0n.com/23lines.zip [autopr0n.com]
Oh, and looking over the comments, I still used windows messaging. If I wrote this code today, I'd probably be able to get it done with even less code.
Re:More lines in C, but same outcome. (Score:2)
I suppose Java is the highest-level language out there, since you can write your whole program on a single line.
--
Benjamin Coates
Poor Planning for the contest (Score:2)
A Contest proves very little. (Score:2)
Only a task that's gonna take years and consume a few hundred thousand lines of code will really show which programmers can stand the pace over the long term, write *maintainable* code, document it well - and so on. Similarly, a program that's developed in a short period of time by a small team tells you nothing about how readable the programming language is. Some languages are easy to write in - but a bugger to understand a year later.
Still, contests are fun - and that's enough to justify their existance.
Good programmers win (Score:3, Insightful)
But then again, you can assume a good programmer would pick a good programming language.
Re:Good programmers win (Score:2)
But then again, you can assume a good programmer would pick a good programming language.
Unlikely... most likely they enjoy a challenge.
-a
What's this? (Score:5, Funny)
I was just getting used to C#, now we are added C! ?
How is that pronounced? 'see bang'?
How is it different from plain C ?
Re:What's this? (Score:2, Funny)
Use the right language for the Job. (Score:2)
Re:Use the right language for the Job. (Score:2)
No language is intrinsicly better. (Score:2)
C gives you lots of rope to hang yourself with
OCAML, on the other hand lets you expressivly designate the contitions under which the rope will hang you.
Language is almost irrelevant (Score:2)
For any given language, the eloquence of the communicator far outweighs the syntax of the language. As with natural languages, it is harder to master the idioms of some languages than others, but that's all.
Uh, computer languages are not human languages (Score:2)
The only thing they even have in common is that they are called languages.
Hrm... (Score:2)
Or was I mistaken?
Do you speak Japanese...? (Score:2, Interesting)
Especially some Asian language like Japanese that has ten ways of saying "me" depending upon the speaker's gender, age, and the context, is much different compared to English.
To make the story short, language shapes the mind of its speaker.
imho, gendered language like Hindi, Italian, Spanish... will always make its speakers see things in gendered manner. And Japanese language speaker will always see things in the respect level embedded in the language itself.
And yes, C++ programmer will see problems in terms of object and its member functions, and polymorphism....etc.
In Japan, there are probably twenty+ different ways of calling "rain," because it's a rainy country with four distinct seasons. In Mongol, there are whole bunch of ways of calling a horse, because of nomadic life.
I am sure when you say "rain," in english, you are not going thru the thought process a Japanese will go thru when she hears "kirisame" or "tsuyu." And Mongolian nomads will see "horse" in a much different manner than you.
Re:Do you speak Japanese...? (Score:2, Insightful)
That's just a few minutes of brainstorming, I'm sure there are more.
-Kevin
What about me? (Score:2, Informative)
I don't think English language will have equivalent translation for: watashi(formal), atashi(fem.), watakushi(formal), ore(rude m.), oi(dialect m.), boku(polite m.), sessha(polite obs.), jibun, unu(dialect), soregashi(obs.), chin(used by noble obs.), touhou(formal), onore(lit), wagahai(rude obs.)
They all mean "me," but used in different context.
Same applies to "you." like kimi, kisama, atana, omae, temee...
The reason why there are so many ways of addressing one another is because Japanese human relationship is never even.
And by using Japanese language, notion of respect level somehow slips in, and thus Japanese speaker will not have the concept of simple "you and I" even relationship. Because they lack the concept of simple "you and I," title names or names are more often used to address others instead of "you," "he," or "she" to clarify the respect level in the sentence.
uh... (Score:2)
no it dosn't (Score:2)
*yawn*
You're ability to say things does not make them true. When will people learn this?
Toki Pona has 120 words (Score:2)
Is Spanish better than English? Does Japanese trump Swahili?
What about Toki Pona [tokipona.org]? It's a small spoken language with 120 words [tokipona.org] that don't inflect. Whether Toki Pona is small in a practical way [scheme.com] or small in an impractical way [muppetlabs.com] is still up in the air.
new vs. old programming languages: thoughts (Score:2, Insightful)
the promise of all newer programming languages is that they are easier to develop, understand, and maintain, because the programmer is elevated to thinking about the "big picture".
i think it's possible to do great things in old languages like C. what it comes down to is, you need discipline. if the compiler/language design has discipline for you, great. otherwise, if you have alot of experience with alot of languages, and are anal, you'll do ok in a small group of similarly talented anal people. in a larger group or project, any not-automatically-enforced discipline will eventually be broken.
unfortunately (?) i still do most of my programming in C/perl. that's because a) i need the solutions i'm developing to work 100%, and i can't afford to run into obscure under the hood problems in still-maturing technologies like ghc [google.com], and b) i like to leverage the huge body of existing libraries out there, and c) i have only worked on small projects (
-- p
Minority programming languages (Score:2)
In a real world environment there is almost no reason to adopt a minority language - outside of everything else it often just creates a code-island. Now, if you can make OCAML the "majority" language of your group, you are set.
Of course coder skill is more important then lang. (Score:2)
Well, yeah. I mean, duh.
Seriously though, while OCaml might have been a better language for the various problems, it should be possible to do it in C, assembly, PASCAL, whatever. It might not be a good idea but it can still be done.
If the second team had known and used OCaml, or some other OO language... or hell even Java or C++ they would have had an easier time. But it may have been that they wanted to give themselves a challenge, to prove that they could do what some could do in OCaml in plain C.
A while ago I was reading about how some proceduralist was complaining that these competitions weren't fair to non-functional coders. The argument made sense, but it shouldn't have been impossible to do the coding in a procedural language.
In fact, I was thinking of doing the contest in Visual basic, just for spite
Partial Challenge Task (Score:2)
"Functional programming wins again" (Score:5, Funny)
Of course it does, you idiot. ICFP stands for International Conference on Functional Programming
Nope, you're just a retard. (Score:1, Funny)
Re:No; C matters. (Score:2, Informative)
a/a=quotient, not quotient+remainder (Score:2)
Re:Idiots. (Score:2)
Solomon (Score:3, Insightful)
Problem is, they've only got one kid.
How much does each parent get?
The story of Solomon points out that there are indeed discrete, indivisible quantities in this world that humans deal with on a regular basis. Though physically, the "type conversion" of the child into two bloody halves is possible, it's not likely what any programmer or parent wants.
All sorts of other discretes exist for programmers. How many packets can I send, given one hour? 4/10th's of a packet is not a packet sent. How many widgets can be produced? A widget almost produced can't be sold. And so on. There is reality other than floats, good sir.
--Dan
Re:Rewrite Linux kernel in Python! (Score:2)
Re:why do people think garbage collection is great (Score:2, Interesting)
Performance, timing constraints, general efficiency... When you write data to disk it is not immediately physically written out (unless you are using unbuffered I/O on a direct I/O filesystem without hardware caching). In both cases the action is performed logically but not physically in order to increase performance.
GC in real-time apps? (Score:2)
If you are using a decent language, 100% of the memory is reclaimed after a full garbage collecting cycle. Maybe it will be once every hour, or once every second, but guess what, it is extremely carefully tuned by the garbage collection programmers.
Would you recommend using a garbage collector in a real-time application such as a video game? I suggested it once on a video game programmers' mailing list, and I was told that anybody who would use one should be shot [yahoo.com].
Re:which functional language to learn? (Score:2, Interesting)
No idea about pedagogicalness, but...
Personally, I started from LISP, and it has proven to be pretty useful. I use XEmacs, so writing stuff in elisp is kewl, and also many programs use Scheme as their scripting language, which of course made LISP skill valuable (Scheme is basically simplified LISP).
I don't know which really is better, OCaml or Haskell; I've personally only tried a little bit of Haskell - and I tried it because it was advertised as a purely functional language, something that made it a little bit more interesting.
But my day-to-day functional stuff is still all in LISP and Scheme =)
Re:which functional language to learn? (Score:2, Informative)
Haskell:
Nice language, but I've never found any implementation that is complete enough to use for real programs.
O'Caml:
Nice language. Nice implementation. Nice library. Currently what I'm using.
Scheme:
Very small lisp. Often used as an extension language (for example in Gimp). It's a common discussion if this is an academic toy language or if it's fit for real programming. I'm not quite sure. Anyway, it's easy to learn (the standard is only a few pages), and there's a nice book for it (The Little Schemer (don't let the cartoons and food receipies fool you, this is one scary book)).
Common Lisp:
Is paradigm adaptive. That is, if you want to write functional, you can. If you want to write imperative, that's nice too. It's my favourite language, but I've had problems finding an implementation that has ok thread support and costs more than a car (no pun intended
Re:which functional language to learn? (Score:3, Interesting)
I'd suggest the following three languages:
1. SML
SML is the language on which OCaml is based. OCaml is really just SML with different (read: worse) syntax, some small differences, and then OO support.
SML will probably be easier to start off on, is better supported and better documented.
Once you've got SML down, OCaml will be easy.
SML is strongly-typed, via type-inference.
2. Common Lisp
This is probably the most powerful language in existance.
Functional if you want. Side-effects if you want. Based on mathematical theory. Closure of data and code. With CLOS (builtin) you get an incredibly powerful OO system.
Common Lisp is dynamically typed and CLOS supports dynamic multiple-dispatch for typing.
Lisp's defmacro system will open your eyes to a whole new world. It is the most powerful macro system you'll ever use. You can perform arbitrary transformations to your code. You'll never think the same way again once you've gotten the hang of defmacro.
3. Haskell
A very simple language to pick up the basics of. Pure functional. Lazy evaluation.
A different idea than SML or Lisp.
I think those three languages would expose you to pretty much all of the concepts of functional programming as well as all the different kinds of syntax you are likely to run across in functional languages.
If you have some time to read up on lambda calculus it might be worth it.
I also strongly recomment both of Paul Graham's Lisp books.
Good luck,
Justin Dubs
Re:which functional language to learn? (Score:3, Informative)
From the Caml Faq [inria.fr]
The main reason is historical: Caml was invented before SML.
The Caml language is issued from the original ML language, invented by Robin Milner in 1978, and developped jointly at INRIA from 1981. The first Caml compiler was written in 1984, and distributed from 1985. Standard ML was not yet invented, and Caml's syntax was similar to the syntax of ML V6.2, whose compiler was used to compile the first Caml compiler. When the syntax of Standard ML has been defined, Caml kept its own syntax, for several reasons. The first reason is questionable and subjective: we thought that SML's syntax was not a major improvement of the original ML syntax (hence of Caml's one). The second, more fundamental, reason is that we thought the language not to be mature enough at that time to be completely defined and fixed by a standard; we are still doing some progress on the understanding of some features of ML, and these progress may imply some important modifications of the language (let's cite the type checking of imperative features or the semantics and type checking of modules). In addition, we wanted to be free to add some new constructs (and indeed we did it, e.g. ``for''loops, ``try with'' and ``match with'', character constants, access to vectors and strings, ``mutable'' annotations for records, ``when'' clauses in pattern matching). This relative freedom with respect to the syntax allows the emergence of new variants of Caml: for instance the Caml Light and Objective Caml systems have their own extensions to the core syntax of Caml.
Hence Caml has its own syntax.
More interestingly caml has a pre-processor(camlp4) [inria.fr]which allows to write in various other syntaxes. E.g. there is a Standard ML syntax, as well as a lisp-ish syntax.
They both have nice documentation. They are so similiar I doubt it makes a lot of difference. The nicest new programmer ocaml documentation is The Oreilly Book Developing Applications with Objective Caml [inria.fr]. With the exception of Ocaml's object oriented features, most ocaml documentation can be used w/ SML, and vise versa.
For whatever its worth, camlp4 gives you a nice macro system too. I don't know how it compares w/ common lisps, but it does give you static checking of your macros and let you work at the abstract syntax tree level.
Re:which functional language to learn? (Score:2)
Justin Dubs
Re:which functional language to learn? (Score:2, Interesting)
I started with SML, but thought it was impractical. I think it was limitations with the library, but when you are generally frustrated, it's pretty hard to identify the exact cause. Anyway, it turned me off ML for a while. Until I discovered O'Caml. Really opened my eyes.
So my advice is to jump directly at O'Caml. SML might have a slightly more pedagogic or clean syntax, but an environment that makes you feel powerfull is more motivating and therefore more important in the start.