3 ms·
why is python preferred above scheme or any other lisp, like clojure? Can we stop promote imperative-ish languages and focus on where lambda can take us?
by morphir 17y ago
why is python preferred above scheme or any other lisp, like clojure? Can we stop promote imperative-ish languages and focus on where lambda can take us?
- TriinT 17y agoPython is very easy to learn, very intuitive. For someone who has done numerical computation with MATLAB, Python is a very natural language to use. By contrast, LISP is hard to learn, unintuitive, and unnatural. In the real world people care about obtaining results as fast and painlessly as possible. The language is just a tool, not a goal.
- ubernostrum 17y agoBecause Python mixes: * Easy to learn (including a REPL), * Multi-paradigm programming (doesn't shove a One True Way To Program(TM) down your throat), and, most important of all, * Solid, battle-tested libraries for the domain (SciPy/NumPy/Sage/etc.) and an easy-to-use interface to/from C.
- hyperbovine 17y agoAlso, the code is extremely readable. I can't think of another language that communicates the programmer's intent better than Python. People often write code aesthetics off, but it really matters. When your audience includes not just fellow programmers, but also potential collaborators, who may or may not know Python, as well as your adviser, who knows only FORTRAN, having a language that self-documents is helpful.
- xtho 17y agoThe French call it déformation professionelle, which works wonders when it comes to perceiving the weirdest stuff as perfectly normal.
- morphir 17y agoYeah, I forgot - scheme does not have a repl... Come on! Multi paradigm? scheme is mp but encourages fp style. Such that side-effects are reduced to a bare minimum. And most lisps are mp. Even better - the object systems are many and modular with lisp. How many object systems are there with python? The problem with scheme is not with DSLs either, it is where most LISP shines like a rockstar! Building domain specific abstraction is trivial with scheme as long as you do a bottom-up approach. Scheme DO have FFI - not only that, scheme can compile to C. Can python do that? NO! And its not because of the prefix notation either. Sure it takes a little while to get used to applicative order of evaluation, but thats only because some idiot taught you the imperative way first. I used python before I got aware of scheme, and believe you me, I got a lot more educated on how to create applications when I watched SICP and read the little schemer books. Also, lets not forget how much time you spend doing memory management when doing C/C++. It's painful, and a waste of good time and money. Python has matured faster than scheme because it has focused on building libraries rather than being standard. Also, there is only one python implementation - where there is many schemes (most of them half-assed) and lisps. This makes it difficult to choose and land on a lisp that can do all and be all, and as such does not provide any traction for the language. There is one modern lisp that could change all this, and that is clojure. If clojure can provide all necessary libs that the working programmer need to have at hand we can see functional programming hit the mainstream of enterprise developement, research and whatever domain there is a need for computation.
- jbjohns 17y agoActually, lisp matches all of those as well. It might not be the easiest to learn coming from C, but otherwise it's not bad.
- samdk 17y agoLisp is significantly harder to learn for most people--especially those people who are programming only as a means to an end and not for fun. Lisp goes significantly farther towards shoving FP down your throat than Python does any individual paradigm. Lisp does not (to the best of my knowledge) have anything to match scipy/numpy. Now, this doesn't mean that I wouldn't prefer if the scientific community were dominated by FP instead of Fortran and Python, but I think it's very easy for people like us to go and say "FP is easy" without realizing that for most people it's really not.
- morphir 17y agoNo its not 'harder' to learn. You just have to understand the concept of applicative evaluation and prefix notation. Then recursion and higher-order functions. That is four things. (Macros can be considered advanced). In the end, all functions evaluates to a value. Thus functions are considered to be data. This value (data) is then passed on to the next function as arguments, and so on.. Anonymous functions is also something which kicks ass, and you miss such features when programming in C. This is one reason why C programs should be left as simple as possible, with as little abstraction as possible. (Fortran? Come on!)
- samdk 17y agoRecursion is very hard for most people. Lisp is quite simple, yes, but FP is an entirely different style of programming that takes a lot of people time to learn and get used to.
- jbjohns 17y ago>Lisp goes significantly farther towards shoving FP down your throat than Python does any individual paradigm. This is simply not the case. It has the best OO system in existence. It has the loop macro (mini language). In actual practice I think lispers tend to not program so functionally because they're instinctively afraid of consing.
- klipt 17y agoThere is actually a version of lisp geared towards numerics/science: http://lush.sourceforge.net/index.html http://lush.sourceforge.net/index.html However, looking at the examples it seems to be used imperatively anyway (it even lets you include C code inline): http://lush.sourceforge.net/screenshots.html http://lush.sourceforge.net/screenshots.html
- papaf 17y agoI'm currently in a computational biology lab and people are allowed whatever suits them to tackle a problem. I'd say that there is an equal mix of octave, R, lisp, fortran, C++ and python. I'm the heaviest user of python and this is because it allows me to get things done quickly (I need to concentrate on the science and not the joy of programming during office hours). Python is a great scripting language and that's how I use it. I find that I have to think too much when using Lisp on simple programming tasks and I'm being challenged enough by the maths or logic of the problem I'm working on. That said, all genetic programming is done is Lisp because no other language comes close. The numerical performance of Lisp is also very good -- I'd say about 1/2 that of C++ when using SBCL. This speed is fast enough and impressive for a dynamically typed language.
- jast 17y agoAll GP is done in Lisp?? Sorry but that is far from true! In the EC community C/C++ and Java are the most common languages used. Just take a look at the popular EC libs out there (EO, ECJ, OpenBeagle, TinyGP, etc). Even Python and Matlab are well more accepted as programming languages than any kind of Lisp. It's sad but it's true. You don't know the "fight" that is to use Lisp in this field/community. The few times I use Lisp is for solo work, because every time I do collaborative work people simply refuse to even considered it. The myths against Lisp are pretty strong and people just refuse to change their minds. Which I think it's kind of ironic since in a science/research environment, people should be more open-minded. Oh well...
- silentbicycle 17y agoI think papaf means all GP done in his/her computational biology lab, specifically.
- jast 17y agoOn a second reading, you're right. But the truth is that in the EC community, and GP in particular, Lisp is not used. 1/2 of C++ speed is just considered too slow. IMHO, I guess speed is just the easy excuse.