Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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?



Curiosity, not argument:

Why don't you think Clojure meets those criteria?

- Canonical implementation on the JVM

- Borrows modern functional programming concepts from Haskell (type classes -> protocols, immutability, etc)

- Robust concurrency constructs. While not directly copied from Erlang, designed with clear understanding-of and respect-for Erlang's successes and failures.

- Minimalist standard library

The only thing I can think of that isn't minimalist would be the reader-macros for vectors, maps, sets, lambdas, etc. However, it seems like those serve to reduce confusion & strike a decent balance between uniformity of syntax and clarify of meaning.


I'm not an expert in Scheme, Clojure, or teaching programming, but here's a few reasons why I don't think Clojure as it is TODAY would be the best language ever for learning programming (I don't really think Common Lisp is either, despite the fact that I loved Land of Lisp).

- Clojure has these horribly huge Java stack traces when you hit an error. Newbies are going to run into errors frequently, and they don't know Java. Even I find this kind of frustrating when using Clojure (and I know Java), if only because it's annoying to have to scroll back just to read the error. This could change! I'm sure it will. But it's the state of Clojure today.

- Modern function programming and concurrency stuff isn't really necessary for beginners. Sure, teach them purely functional programming to start out with, a la SICP, if that's your thing, but I think that Clojure's concurrency primitives (various reference types, immutable data structures) are a bit too advanced.

Scheme is just ever so slightly simpler and I think that matters. Just my 2 c. I love Scheme and Clojure and Lisp, I'm just not experienced with teaching programming to total beginners, so take all this with a handful of salt. I tend to be conservative when it comes to these kinds of discussions and would be happy with new programmers using Python, because it's so much better than Java.


> I think that Clojure's concurrency primitives (various reference types, immutable data structures) are a bit too advanced.

While newbies rarely need reference types (other than var, of course), I don't think there's anything particularly "advanced" about immutable data structures. Considering that most people learn math before they learn programming, immutable data might even be an easier concept to grasp for a complete newbie than imperative programming with mutable data is.

You might think immutability is advanced but that's most likely because you learned to program with mutable things initially.

As an aside, I agree that Clojure's stack traces are pretty bad, but there are tools that improve the mess quite a bit, eg. clj-stacktrace. The stacktraces might not be quite as intractable to newbies if you integrate that into the REPL.


I would argue that it's very useful to learn about data structures and the immutable/mutable distinction upfront (hashtables vs. balanced 2-way trees vs. Bagwell 32-way HAMT vs. "exotics" like skip trees.) I dunno if CL make these as easily avail as clojure

Re: Stacktraces, they have nicer formatting at least, but cutting out irrelevant parts of stack is tough. You can also set

    *stack-trace-depth*
http://dev.clojure.org/display/design/Stacktraces

http://technomancy.us/154


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?


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.


You don't need to make this leap if you haven't learned imperative programming before functional.


I've tried introducing one person w/ higher mathematics knowledge to scheme and it went well.

I think that people think that imperative programming is somehow 'more natural'. I still sort of think that but, I haven't seen that bourne out when I try teaching programming.

All programming is foreign to people when they start. And you are influenced by what you start with.

I started with Forth ( ages ago ) and when I first started using an imperative language, it was a struggle for me.


I think imperative programming is more foreign for someone who doesn't know programming. Defining a program using equational reasoning is more natural to someone who knows basic math.


Scheme may be an ideal "teaching" language because it's so small, but it's not an ideal learning language because you will quickly run into problems with libraries and implementations. The RnRS is also not as good a reference as the HyperSpec+CLtL.

Common Lisp code is much more portable across implementations so there are way more libraries and bindings to things like graphics and sound around (and easily available via quicklisp).

Racket OTOH is the best environment for learning to program in that I've come across, and I recommend it to people who ask me for advice about learning to program (despite being the author of that article). If Common Lisp had a similar environment for newbies it would be sweet, but not many people (myself included) care about Lisp IDEs.

The problem with Racket is that it has a huge problem with NIH as a project, and a lot of the libraries are opinionated about the way you use things like state.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: