I think Lisp still has an edge for larger projects and for applications where the speed of the compiled code is important. But Python has the edge (with a large number of students) when the main goal is communication, not programming per se.
In terms of programming-in-the-large, at Google and elsewhere, I think that language choice is not as important as all the other choices: if you have the right overall architecture, the right team of programmers, the right development process that allows for rapid development with continuous improvement, then many languages will work for you; if you don't have those things you're in trouble regardless of your language choice.
Thank you, Peter. This is how I have felt for years, but could never find words that describe it as well as you just did.
Someone should write a program that automatically posts this paragraph at the top of every language war thread. I think they should write that program in php :-)
Now with the first question, familiarity with the language, lets discuss Python. Python is my language of choice. I know it, I use it, I pay attention to what is happening with the language, the community, etc. I organize a Python User Group. If I were to work on a new project, I would choose Python. I believe I could launch 10% if not 50% faster with Python than with Ruby. Does that make Python a better language? No. Just that I don't know Ruby, Rails, Sinatra, etc.
The way I read Peter's comment was you don't want to spend you time finding the best language. Instead you want to just grab the most convenient language and spend your time creating the best product. Think through your architecture, work on your design, test the hell product, study the market, your competitors, work on your marketing, and on and on. The list of things to do never end, and if you were still debating about which language to choose, you won't launch.
Some languages make it easier to become familiar with the libraries. Compare the standard libraries of Ruby and Python with PHP. Even though I programmed in PHP for several years I always had to look up argument order, or whether the names of functions contained underscores between words or not.
But I've also been astounded at how slow CPython is compared to SBCL (the Common Lisp implementation I use) when I have to do long runs to gather data. (For the things I've been playing around with, my Common Lisp implementations have been something like 5 to 20 times faster.)
a = 0
b = 100
s = 0
for (i from a to b)
s = s + i
If such pseudo code can be embedded into SBCL it would generate fast machine code, also it would be possible to easily modify pseudo code syntax.
This lets you write things like:
(for var in form do ...
(for var in form collect ...
where form can be anything that has an iterator method defined on it.
There's also a macro I use called BINDING-BLOCK (BB for short) which subsumes a bunch of binding forms. So you can write things like:
:db (q r s) (...) ; Destructuring-bind
:mv (p q) (...) ; Multiple-value-bind
(It's a little out of date. If you want the latest let me know and I'll update it.)
like in scheme:
(let for ((i 0) (s 0))
(if (> i 100) s
(for (+ 1 i) (+ i s)))))
why would you care for those a, b, or s variables in the first place when all you want is the sum? The above expression writes the sum as computed by a recursive approach using lexical bindings.
you may of course abstract it away into a function:
(define (for from to doit result)
(if (> from to) result
(for (+ 1 from) to doit (doit from result))))
and use it:
(let ((a 0)
(for a b + 0)))
I didn't even need macros yet!
As school teacher on programming I'm limited in choice of programming languages. The only language which I can study is Pascal (a lot of other reasons on it). The problem is that Pascal have not any libraries (GUI, 2D/3D, Game Development Engines, programming micro-controllers, ...). Students can write only simple console applications. So, it was be ideal to have subset of Pascal as eDSL on top of Common Lisp or Clojure. In that way I can easily extend original Pascal to access some real world libraries.
I think also on top of Common Lisp we can develop some simpler eDSL as pseudo-code for beginner students.
PS: gone to learn Common Lisp...
It's not true. Lazarus (http://www.lazarus.freepascal.org/) gives pretty much everything Delphi has.
Currently I develop OpenGL 2D analytical tool. Again GUI is on par with Delphi.
LOOP shows some of the practical problem. For example for LOOP one needs a custom highlighter in the IDE, because it has its own complex syntax, which does not follow the basic Lisp model.
Same for indentation / code formatting. There maybe other problems.
There is another Iteration facility as a library for Common Lisp called ITERATE. It is very similar to LOOP, but the syntax is a bit more oriented towards Lisp.
I have found two examples:
1. Python in Lisp: http://github.com/franzinc/cl-python
2. Ruby on Lisp: http://jng.imagine27.com/articles/2010-10-07-084756_ruby_sub...
I will try to write little subset of Pascal as eDSL on Lisp.
I came to conclusion that it is easier to do external DSL, not embedded. Parse source code on Pascal and then translate it into S-expressions. Am I right?
Btw, if I'm gonna write external DSL, I can do that in any language for example on Python. So, what's the difference?
And thank you PG/YC for giving me the opportunity to do so.
Communication is increasingly the more important part of programming. Engineering is only really useful if its well communicated, or in a binary you trust.
oops, it seems it already happens today...
Well from what he writes, he seems to say Python looks much closer to their actual pseudo-code, and it's therefore easier for students to translate pseudocode to Python than to Lisp.
> In my opinion, it is better for most people because they were taught syntaxes
Such as english. One of the original goals of Python (inherited from ABC) was to be a good teaching language. I'd expect that when Peter talks about his students, he's mostly talking about students with low-to-no knowledge in programming. Those who are already knowledgeable probably don't have a hard time adapting.
Problem Solving Agent for Traveling Salesman Problem. 1. Depth First Search (function argument- DFS)
2. Iterative Depth First Search (function argument- IDFS)
3. A* - Heuristic: Path Cost Incurred (function argument- PATH)
4. A* - Heuristic: Minimum Spanning Tree heuristic (function argument- MST)
5. (Extra Credit 25 points ) Create and implement a heuristic equal to or better than MST
In this project we implement a decision tree induction algorithm in Lisp.
I had played around with lisp before this point and found it fascinating. I approached these projects with excitement. But even with 8 years of serious programming experience, I could not for the life of me solve these problems in lisp. My problems included:
1. Knowing exactly what methods I wanted to call and use and either
a. Not being able to find them in any reference I found online, or
b. Finding out that they don't exist, and you have to write them yourself, or
c. Finding them and shaking my head at how ridiculously they were named.
2. Not being able to read the code I had just written.
3. Not being able to debug.
4. Finding that manipulating common data structures like hash tables is a total chore.
Eventually I gave up. I had spent about two hours trying to implement the project I had already solved in my head into common lisp and was making little or no progress. So I fired up another vim terminal, solved the project in Python in about 30 minutes, including debugging, and then manually translated the code into lisp.
When project 2 rolled around, I decided to give it another go, but I quickly became frustrated again. Maybe my mind just isn't able to grok lisp? Maybe I'm just not smart enough?
All I'm claiming is that I am an example of a student who was already very knowledgeable about programming and completely unable to adapt to lisp.
Redesigning a data format to match how I notate and think about it, to minimize my cognitive load, has been very helpful to me.
The long-term trend in computers seems to be to trade performance for helping the developer.
> when the main goal is communication, not programming per se
This reminds me of debates about the scientific method. Some say that you can test hypotheses etc alone without publishing and you are doing science; but others define science as a community activity, and so without publishing, it is not 'science'. While I love the idea of the lone researcher, and clever insights definitely come from individuals, without a community there is no SOTSOG.