
Common Lisp is the best language to learn programming - sedachv
http://carcaddar.blogspot.com/2011/10/common-lisp-is-best-language-to-learn.html
======
Fixnum
I think Scheme comes the closest to being an ideal teaching language. It has
all the same advantages adduced (great books, simplicity, power) in even
greater measure. For instance, there's no 'funcall, 'apply, and sharp-quoting
everywhere, and no powerful but baroque object and package systems deeply
integrated into the language. Scheme macros are a bit complicated (especially
implementation-wise) but can be sugared over (e.g. define-syntax-rule or CL-
like syntax for basic macros) and at least they're "correct".

Scheme isn't perfect, of course, and I'd love to see a modern Scheme-like Lisp
with a canonical implementation and borrowing freely from Haskell, Erlang, and
friends while preserving its minimalist ethos (somehow neither Racket nor
Clojure is this).

Of course, the readiness is all ... while there's a beauty in simplicity, can
a novice without any higher mathematics really appreciate the style of
programming one does in Scheme?

~~~
flounder
I tried learning Scheme. I found that the syntax was easy, basic recursion was
easy, solving simple math problems was easy, and even dealing with cons and
cdr was pretty easy. What's difficult is learning functional programming.

Anyone can pick up Scheme syntax really fast. Where it gets difficult is when
people start telling you to not use state, not change values of variables, and
to stop using side-effects.

Most people have _never done functional programming_. How does one make the
leap from imperative programming to functional programming?

~~~
unoti
Here's how I did it for Scala. I went to project Euler, and did the first
problem. Then I looked at other people's answers in the same language. I
discovered they were doing these tiny little 1 line solutions using functional
programming techniques, where I did much larger solutions. I started studying
every aspect of how these solutions worked. Along the way I learned about
fold, filter, map, and so on. Then I re-implemented my solution using
functional idioms. Then I moved on the the next project Euler problem. It
didn't take long until I had a pretty firm grasp of it. I did this in Scala;
perhaps the same approach would work for you in your language of choice.

------
spooneybarger
After learning a large number of programming languages, if I was going to
start someone fresh with learning to program, I would pick either a scheme (
in particular racket ) or a smalltalk.

Scheme is a little bit on the 'toolkit-y' side and slightly less accessible
than smalltalk for someone just starting out but, both have what I consider
most important:

a minimum of rules and syntax. anyone learning to programming in either would
be primarily focused on how to solve the problem in front of them rather than
solving the language.

This all said, I haven't tried this out in any scientific fashion so it is
mostly just intuition.

------
thedufer
This feels like something that someone completely removed from people who
don't know how to program would say. I can't imagine the horrors I would've
gone through if I couldn't fall back on the fact that my first language (C++)
basically looked like the mathematical notation I was used to (infix binary
operands, prefix functions). Until the standard is to write math in prefix
(I'm definitely not condoning this), Lisp is not the right language to start
with.

This remains the biggest problem with places like HN. When everyone has a
similar background, they can agree on conclusions that the rest of the world
would find ludicrous.

~~~
luckydude
As far as I know, the hacker news site is written in some lisp, with lots of
lisp fans here.

I'm with you though. Lisp can be great for some problems but it's mostly not.
The lisp guys hate hearing that and shout you down.

One measure of a language is how well it works to pass on a source base to a
new team of programmers. I bet if someone were to go measure lisp against C
they would find at least a 100x greater success rate with the passing on of C.

The lisp guys are profoundly focussed on how easy it is for them to write
code. The real world is more concerned with how easy it is to maintain,
review, enhance code.

~~~
eeperson
This seems like a strange accusation. It seems like the usual complaint is
that lisp programmers are more concerned with elegance than getting anything
accomplished.

I think this provides an interesting counterpoint:
<http://www.infoq.com/presentations/Simple-Made-Easy>

~~~
tsotha
Heh. As much as I agree with pretty much everything he says in that
presentation the GP's point is pretty relevant here: Rich Hickey is far, far
to the right on the programming bell curve. Things normal people will have
real difficulty grasping are going to seem glaringly obvious to someone like
that.

------
chimeracoder
I definitely agree, with a caveat: I would say that (Common) Lisp is the best
language to learn computer science. If I had only an hour to teach a young
child some fundamental CS concepts, I would make sure to include the concept
of recursion. Common Lisp makes this, as well as a few other CS 'building
blocks', trivially easy.

(The reason I'm distinguishing between programming and CS here is that
'programming' is a broad term that encompasses a number of use cases. If
someone wants to learn 'programming' to throw together a few simple webapps or
do some text processing, Lisp will get the job done, but they probably won't
care too much about learning these fundamentals).

------
tsotha
That's not what I would teach first. I'd start with a simple assembly
language, like 8080A. After that C, and _then_ lisp. The problem with starting
students on lisp is they have a hard time grasping what's going on under the
hood.

~~~
danso
Er...depends on why the students want to program, right? I studied assembly
and I may be taking for granted the computer science foundations that it gave
me, but it has almost no bearing in what I do in my current day programming.
And I had learned C, C++ and Basic before my assembly classes.

Teaching students assembly as their very first language seems akin to teaching
students Latin before they can learn French, German, Spanish, etc. Sure, it's
helpful and...IF they get pass that first dry session.

~~~
rbanffy
An simpke, elegant 8-bit microprocessor is very simple to hold in one's brain.
That said, the 8080 and its offspring would never be my choice. I'd suggest
the 6502, the 6809 or the 32032 (which is not 8-bit, but very easy to
understand)

~~~
twstws
There's a big difference between 'simple to hold in your brain' and 'simple to
do something useful with'. For someone just starting out programming, the
second is arguably much more important. The article mentions Land of Lisp
presenting a simple web server in 15 pages of text. What would you be able to
explain in 15 pages of text for assembly?

~~~
RodgerTheGreat
Well, JonesForth manages to explain a self-hosting Forth compiler/interpreter
(as well as the language itself) in about 30 pages of assembly, including
extensive references and ASCII-art diagrams:
[http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jone...](http://git.annexia.org/?p=jonesforth.git;a=blob_plain;f=jonesforth.S;hb=66c56998125f3ac265a3a1df9821fd52cfeee8cc)

Seems like that should qualify as comparable.

------
antimora
I think it's Python not Lisp. This is my opinion.

~~~
WildUtah
If you want the newbie to learn something immediately useful and with the
potential for deep understanding of some programming concepts, there's one
clear choice. Unfortunately, that choice is JavaScript.

JavaScript is the language the modern web is written in and it's a language
you can use to build and automate cool stuff that you can show immediately to
your friends. You can build interactive programs, save state (in cookies),
deal with formatting and input, and even do graphics with CSS or canvas.
jQuery or its competitors will cover up most of the warts.

It's not a brain dead verbose bondage experience like Java nor deep in the
metal like assembler. It isn't historic and systems oriented like C or mathy
and abstract like Scheme or LISP. It can take advantage of much of the
semantics of those languages as you learn it if you need them.

The tools to write and run it are simple and some good debuggers are built
into your browser. Everyone owns a few client interpreters with a great
application environment.

It's not pretty (boy is it ever not pretty) but JavaScript is the best
language to start with.

If I couldn't choose JavaScript, I'd point my friends at Python or Ruby.
They're better languages for both beginners and experts but they're not
JavaScript.

~~~
orthecreedence
I agree on a few points and also disagree on some.

I agree that javascript is very easy to get started with. The syntax is
similar enough with other languages (C, Java) such that you could just into
one of them easily after a bit of experience with javascript. It's also very
easy, as you said, to actually DO something with it. You don't have to import
500 libraries to draw a line on the screen or make highly interactive (or even
beautiful) interfaces. Javascript is also somewhat close to lisp in its
functionality.

That being said, I feel as though learning javascript first is putting the
carriage before the horse. If someone is learning to program, I believe it's
best they start off learning the basics. The idea is to learn the concepts
behind mathematical thought...to learn the rules, and then learn to break
them. I think someone who learned javascript first would know how to do things
great in javascript, but not necessarily any other languages. They would know
how to program interactions, but not necessarily how to program in general.

Another thing to keep in mind is that javascript is highly concurrent. You
almost can't do anything in it without dealing with layers of events
interacting with each other. This could be confusing and detrimental to
someone who's just beginning to learn.

I'd argue it's best to start with C/assembly for a low-level view of how
computer work, and then afterwards lisp and perhaps javascript for higher
mathematical programming.

------
GeneralMaximus
As I've said elsewhere, your choice of language must be driven by what
libraries you want to use. I read Land of Lisp earlier this year and went
through the Racket guide a few months ago. Currently I'm rewriting my blog
using Seaside on Pharo Smalltalk. The one thing that keeps coming back to bite
me in the ass is that there are few libraries available for any of these
languages. When libraries are available, they're poorly documented.

Of course, this is becoming less of an issue in Common Lisp thanks to
QuickLisp. There's a Racket book coming out next year, which might help with
adoption and result in better libraries. Still, it will take years before any
of these languages catch up to Python/Ruby/Java.

Edit: I thoroughly enjoyed learning and playing with all three languages.
Smalltalk, in particular, felt very natural. It has the eerie property of
seeming like an extension of your brain.

------
_mrc
Depending on the goals of the learner, something with immediate visual
feedback is nice. Logo/turtle graphics or Smalltalk would be good for this.

While you're not going to write my-first-blog in Logo, it's something my 5
year old can get her head around. And it's the thin edge of the lisp wedge :)

~~~
sedachv
Agreed. Warren Wilkinson had an idea for a simple Lisp wrapper to SDL for this
purpose ([http://formlis.wordpress.com/2011/01/22/teaching-children-
pr...](http://formlis.wordpress.com/2011/01/22/teaching-children-
programming/)). But it needs to be something even simpler, "Logo easy." HTML5
Canvas is actually a good system for this IMO.

------
daniel-cussen
The first language I learned was clisp and it was the only one I used for the
first two years.

It was awesome. It was a long learning curve, and I couldn't do almost
anything for a really long time, but I got to a point where I knew everything
about this tiny universe and had a solid foundation to branch out from. With
that I went on to learning java, python, js, and c, and became fascinated at
how much faster things became as I used more state and therefore got closer to
the hardware.

For a while I was a little worried that I would only be able to use functional
programming and would not be able to learn how to use state, but that was not
the case.

------
Volpe
Yep, just like the best way to learn carpentry is "Hammer".

Languages are tools, people learn differently, there is no best way.

If there was though, it'd be Ruby. ;)

~~~
chimeracoder
> If there was though, it'd be Ruby. ;)

I know you're being tongue-in-cheek with that, but I think there are three
distinct use cases for learning to program.

For people who want to learn CS from a ground-up, theoretical foundation, Lisp
is a nice choice. It is very easy to teach functional programming while
simultaneously teaching the fundamentals of theoretical computer science, so
you get the best of both.

For people who want a bit more 'traditional' approach, and also want to learn
about computer science from a low-level perspective, C is a good choice. It
teaches memory management and gives an insight into computer hardware &
systems that higher-level scripting languages don't. (This latter part is
where Java fails - how can you appreciate references and garbage collection
until you've mucked around with pointers and malloc() in C?)

For people who just want to dabble in programming, or for people without a
mathematical background, or for people who just want to prototype small
projects quickly... then yes, scripting languages like Ruby (or Python) would
be the 'best' way.

As you said, languages are like tools, but I think these three categories of
tools cover the majority of use-cases nowadays for the beginning programmer.

~~~
dagw
I'd add a fourth use case (which is somewhat similar to case three). People
who don't want to be "programmers", but just want to learn how to simplify and
optimize the normal day to day tasks they do. In that case I'd recommend
whatever scripting language is standard in whatever app they use. For example
I know people who probably would never claim to be programmers and never had
any desire to learn programming for programming's sake, but have still taught
themselves to do pretty advanced stuff in VBA, AutoCAD Lisp or MEL (Maya's
scripting language) because they saw how much easier it made their work.

~~~
sedachv
RMS has an interesting anecdote about this in his speech on Emacs:

"[Bernie Greenberg] wrote a version of Emacs in Multics MacLisp, and he wrote
his commands in MacLisp in a straightforward fashion. The editor itself was
written entirely in Lisp. Multics Emacs proved to be a great success —
programming new editing commands was so convenient that even the secretaries
in his office started learning how to use it. They used a manual someone had
written which showed how to extend Emacs, but didn't say it was a programming.
So the secretaries, who believed they couldn't do programming, weren't scared
off. They read the manual, discovered they could do useful things and they
learned to program."

<http://www.gnu.org/gnu/rms-lisp.html>

