4 ms·
I haven't seen much functional code in elisp, which is the Lisp I most commonly read. Some Common Lisp code I saw was also very imperative. Scheme seems to be
by Peaker 14y ago
I haven't seen much functional code in elisp, which is the Lisp I most commonly read.
Some Common Lisp code I saw was also very imperative.
Scheme seems to be a more functional language, but I don't really see why people consider other Lisps any more functional than say, Python.
- lispm 14y agoCommon Lisp is a multi-paradigm language. The standard supports imperative, functional and object-oriented programming styles. It even tries to mix them. The Common Lisp Object System for example uses Generic Functions, and not the more usual message passing mechanism. The language is also traditionally extended by other paradigms: rule-based, logical, actors, agents, concurrent, ... Still Common Lisp uses mechanisms of functional programming widely. It supports lexical binding, many library functions are higher-order functions, etc. There are also some programs which are written in a very functional style and most implementations support tail call optimizations to further make a functional style useful. Common Lisp does not enforce a particular programming paradigm. As a start all three supported would be used by a programmer. He or she might even add some more, if necessary.
- Peaker 14y agoLexical binding, higher-order functions, etc are very common in Python, for example. Except for TCO which is not widely supported in Python, and problematic if support is not guaranteed, Python seems to be just as functional as CL. Nobody cites Python as a functional language, yet people mostly cite CL as a functional language.
- lispm 14y agoFunctional Programming is discouraged in Python. See the various statements by its Benevolent Dictator starting here: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 http://www.artima.com/weblogs/viewpost.jsp?thread=98196 then here: http://python-history.blogspot.de/2009/04/origins-of-pythons-functional-features.html http://python-history.blogspot.de/2009/04/origins-of-pythons...
- Peaker 14y agoSo more a matter of the atmosphere around the language than the language itself. Intrinsically, Python and CL seem just as fit for functional programming (with semi-legitimate reliance on TCO being a slight benefit for CL's side).