Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to learn? Lisp or OCaml or...? [closed]

I already have a few languages under my belt (in a rough order of expertise): Python, C, C++, PHP, Javascript, Haskell, Java, MIPS, x86 assembler. But it's been almost 2 years since I learned a new one, and I'm starting to get the itch. I have a few criteria:

  1. Must (repeat: must) have a free Linux implementation
  2. Should be different from the languages I already know. In other words, it should have features that get me thinking about solving problems in a new way.
  3. Should have some potential for practical use. It doesn't need to be the next Java, but this rules out Brainf* and Shakespeare :) I don't really care how many job postings does it have, but real-world apps and libraries are a plus.
  4. Should have at least just enough free learning materials to get me started in it.

I was thinking Lisp (CL? something else?) or OCaml. I already have some experience with functional languages with Haskell (yes I know that Lisp/OCaml are multi-paradigm). I'm not an expert - e.g. parts of code from Real World Haskell can still contort my brain, but I understand the basic concepts and some advanced ones (functors, monads).

Which one to choose? Any other languages that I have overlooked? Also, could you please include some useful links to good books/tutorials etc.

like image 517
oggy Avatar asked Jun 28 '09 23:06

oggy


People also ask

Is Lisp a good language to learn?

Lisp empowers programmers to write faster programs faster. An empirical study shows that when programmers tackle the same problems in Lisp, C/C ++ and Java, that the Lisp programs are smaller (and therefore easier to maintain), take less time to develop and run faster.

Should I learn Lisp or Scheme?

You have two main dialects to choose between: Scheme and Common Lisp. They each have advantages and disadvantages, but the differences between them are tiny compared to the differences between them and other languages, so if you want to start learning Lisp, it doesn't matter which you choose.

Is OCaml similar to Lisp?

OCaml is neat too, but not really directly comparable to Common Lisp. Both are solid languages, but I wouldn't put them in the same category.

Is Lisp useful in 2021?

In 2021, this is an argument both for and against Lisp: Lisp implementations are sufficiently fast, so Lisp is best. Modern languages are powerful, so they are best.


2 Answers

Neither Lisp nor OCaml is super far afield from what you already know. Here are four suggestions chosen partly for intrinsic interest and partly to stretch your horizons.

  • A logic programming language, probably Prolog. I haven't found good materials online, but the book The Art of Prolog by Sterling and Shapiro is excellent. The more basic textbook by Clocksin and Mellish is also good. The main point of interest is programming with relations, not functions.

  • A pure object-oriented language, either Smalltalk or Self. If you've only used hybrid object-oriented languages you'll be amazed how beautiful pure object-orientation can be. I've linked to the Squeak implementation of Smalltalk. I personally would recommend learning Smalltalk before tackling Self; there's a very large and active community and the software is well developed. Self stands on Smalltalk's shoulders and is an even more inspiring design, but the community is much smaller. For those who have access to the ACM Digital library I recommend the excellent talk by Dave Ungar at HOPL-III; the paper is also pretty good.

  • The Icon programming language has two great things going for it; a powerful and unusual evaluation model with implicit backtracking, and a user-extensible model of string processing that beats regular expressions all hollow. I'm sorry to say that Icon has never quite kept pace with the times, and of all my recommendations it is the least practical. In fact I fear the language is moribund. But it will stretch your mind almost as much as Haskell, and in wildly different directions. Icon is still very useful for string-processing tasks of modest size.

    You can read about Icon string processing in an article by Ralph Griswold from Computer Journal.

  • The Lua programming language is my last and least radical suggestion. Its interest is not so much in novel language features or paradigms but in the superb engineering of the language and its implementation. Lua occupies a number of niches, including scripting, gaming, string processing, and lightweight functional programming. But its main point of interest is its seamless integration with C, and to get the full benefit, you should bind a C library into Lua.

    The HOPL-III web site also contains an excellent talk and paper about Lua.

like image 170
Norman Ramsey Avatar answered Sep 18 '22 16:09

Norman Ramsey


Both Common Lisp and Ocaml are certainly useful to learn. If you already know Haskell, CL might be the more different experience.

SBCL and Clozure CL are both very useful implementations of Common Lisp on Linux. (Overview about various implementations: Common Lisp survey.)

As a starting point I would recommend to use Peter Seibel's excellent book Practical Common Lisp, that is both available online and printed.

Community pointers are here: CLIKI.

like image 20
Rainer Joswig Avatar answered Sep 18 '22 16:09

Rainer Joswig