views:

1018

answers:

17

Lisp developed a set of interesting language features quite early on in the academic world, but most of them never caught on in production environments.

Some languages, like JavaScript, adapted basic features like garbage collection and lexical closures, but all the stuff that might actually change how you write programs on a large scale, like powerful macros, the code-as-data thing and custom control structures, only seems to propagate within other functional languages, none of which are practical to use for non-trivial projects.

The functional programming community also came up with a lot of other interesting ideas (apart from functional programming itself), like referential transparency, generalised case-expressions (ie, pattern-matching, not crippled like C/C# switches) and curried functions, which seem obviously useful in regular programming and should be easy to integrate with existing programming practice, but for some reason seem to be stuck in the academic world forever.

Why do these features have such a hard time getting adopted? Are there any modern, practical languages that actually learn from Lisp instead of half-assedly copying "first class functions", or is there an inherent conflict that makes this impossible?

+6  A: 

Scala's a cool functional/OO language with pattern matching, first class functions, and the like. It has the advantage of compiling to java bit code and inter-operates well with java code.

sblundy
+3  A: 

Have you checked out F#

Josh
Nope. Seems a bit too coupled to Microsoft/Windows.
ben
then try what it's cross platform parent, ocaml.
nlucaroni
+2  A: 

Lot's of dynamic programming languages implement ideas from functional programming. The newer .Net languages (C# and VB) have what they call lambda's but these aren't side effect free.

It's not difficult combining concepts from functional programming and object oriented programming for example but it doesn't always make a lot of sense. Object oriented languages (try to) encapsulate state inside objects while functional languages encapsulate state inside functions. If you combine objects and functions in one language it gets harder to make sense of all this.

There have been a lot of languages that have combined these paradigms by just throwing them together (F#) and this can be usefull but I think we still need a couple of decades of playing with languages like this untill we can create a new paradigm that succesfully will combine the ideas from oo and functional programming.

Mendelt
+2  A: 

C# 3.0 definitely does.

C# now has

  1. Lambda Expressions
  2. Higher Order Functions
  3. Map / Reduce + Filter ( Folding?) to lists and all types which implement IEnumerable.
  4. LINQ
  5. Object + Collection Initializers.

The last two list items may not fall under proper functional programming, anyways the answer is C# has implemented many useful concepts from Lisp etc.

This does not seem significantly better than Javascript. C++ has had map/reduce/filter, and I am not sure how linq improves on that.
ben
+6  A: 

Python or Ruby. See Paul Graham's thoughts on this in the question "I like Lisp but my company won't let me use it. What should I do?".

Paul Reiners
+3  A: 

Lua.

It's used as a scripting/extension language for a number of games (like World of Worcraft), and applications (Snort, NMAP, Wireshark, etc). In fact, according to an Adobe developer, Adobe's Lightroom is over 40% Lua.

The guys behind Lua have repeatedly listed Scheme and Lisp as major influences on Lua, and Lua has even been described as Scheme without the parentheses.

Christopher Cashell
+14  A: 

Are there any modern, practical languages that actually learn from Lisp instead of half-assedly copying "first class functions", or is there an inherent conflict that makes this impossible?

Why aren't lisp, haskell, ocaml, or f# modern?

You might just need to take it on yourself and look at them and realize that they are more robust, with libraries like java, then you'd think.

A lot of features have been adopted from functional languages to other languages. But vice versa -- (some) functional languages have objects, for example.

nlucaroni
+6  A: 

Common Lisp, used in the real-world albeit not wildely so, I guess.

Luís Oliveira
+5  A: 

Scala is the absolute king of languages which have adopted significant academic features. Higher kinds, self types, polymorphic pattern matching, etc. All of these are bleeding-edge (or near to it) academic research topics that have been incorporated into Scala as fundamental features. Arguably, this has been to the detriment of the langauge's simplicity, but it does lead to some very interesting patterns.

C# is more mainstream than Scala, but it also has adopted fewer of these "out-there" functional features. LINQ is a limited implementation for Wadler's generalized list comprehensions, and everyone knows about lambdas. But for all that, C# (rightfully) remains a bit conservative in adopting research features from the academic world.

Daniel Spiewak
Scala looks like a language which adopted everything from everywhere. Must be great from learning, but as practically usefull as brainfck
ima
"For learning", typo
ima
+4  A: 

Erlang has recently gained renewed exposure not only through being used by Twitter, but also by the rise of XMPP driven messaging and implementations such as ejabberd. It sports many of the ideas coming from functional programming being a language designed with that in mind. Initially used to run Telephone switches and conceived by Ericson to run the first GSM networks. It is still around, it is fully functional (as a language) and used in many production environments.

+2  A: 

In addition to what was said, a lot of LISP goodness is based on guaranteed lack of side-effects and using built-in data structures. Both rarely hold in real world. ML is probably better functional base.

ima
+7  A: 

I suggest you try Clojure. Syntactically beautiful dialect, functional (in the ML sense), and fast. You get immutability, software transactional memory, multiversion concurrency control, a REPL, SLIME support, and an inexhaustible FFI. It's the Lisp (& Haskell) for the Business Programmer. I'm having a great time using it daily in my real job.

Drew R.
+6  A: 

There is no known correlation between a language "catching on" and whether or not is has powerful, well researched, well designed features.

A lot has been said on the subject. It exists all over the place in technology, and also the arts. We know artist A has more training and produces works of greater breadth and depth than artist B, yet artist B is far more successful in the marketplace. Is it because there's a zeitgeist? Is is because artist B has better marketing? Is it because most people won't take the time to understand artist A? Maybe artist B is secretly awful and we should mistrust experts who make judgements about artists? Probably all of the above, to some degree or another.

This drives people who study the arts, and people who study programming languages, crazy.

jfm3
+5  A: 

Common Lisp is definitely a real-world programming language. Designed in committee and published as a standard, it is not in any way some kind of educational or research programming language (not that there would be any shame being one, mind you). It's even the first ANSI/ISO published programming language to include object-oriented programming!

Nowhere man
+1  A: 

Another "real-world" language that implements functional programming features is Javascript. Since absolutely everything has a value, then high-order functions are easily implemented. You also have other tenants of functional programming such as lambda functions, closures, and currying.

Thedric Walker
A: 

The features you refer to ("powerful" macros, the code-as-data thing and custom control structures) have not propagated within other functional languages. They died after Lisp taught us that they are a bad idea.

Modern functional languages (OCaml, Haskell, Erlang, Scala, F#, C# 3.0, JavaScript) do not have those features.

Cheers, Jon Harrop.

Jon Harrop
+2  A: 

Lisp developed a set of interesting language features quite early on in the academic world, but most of them never caught on in production environments.

Because the kind of people who manage software developers aren't the kinds of people who you can have an interesting chat comparing different language features with. Around 2000, I wanted to use LISP to implement XML-to-HTML transforms on our corporate website (this is around the time of Amazon implementing their backend in LISP). I didn't get to. This is mildly ironic seeing as the company I was working for made and sold a Common LISP environment.

David Hicks