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

Asking as a CS major who first learned C, then C++, and didn't touch LISP and Prolog until the upper divs, how difficult is it to learn a functional language as your first programming one? Wouldn't it be trippy? When I first learned that Berkeley students had to learn Scheme first, it made me think of them as hardcore... though I may be overestimating its difficulty.


> how difficult is it to learn a functional language as your first programming one? Wouldn't it be trippy?

As easy as learning a dysfunctional one if not easier.

Now scheme may not be the best example of this as its syntax is entirely alien (then again all syntax is, when you've never developed), but the canonical is the following statement:

    x = x + 1
If you've never developed before, the only place where you've seen something like this is maths, and in maths this is completely nonsensical.

So learning imperative programming does require lots of deprogramming and reprogramming of your brain. Which make up most of the hurdles of learning an FP (or logic, or dataflow, ...) language later on: your brain (or its section that has to do with development) has been baked in imperative idioms and methods, FP languages not only don't use these but use completely different techniques to solve the same problems, so you have to "unlearn" the old ones and "relearn" the new ones.


I can corroborate that for people with no prior programming experience, but a significant math background (engineers, stat and math majors), the statement "x = x + 1" is befuddling to them. They have no concept of time in a sequence of imperative statements. That is, they don't intuitively understand that statements get executed, and that the state of the program changes (potentially) after each statement. It takes real effort on their part to internalize this idea.

Now, I'm sympathetic to your final paragraph, but having never taught functional programming to anyone, I can't corroborate it. Personally, I went through something similar when first learning how to think functionally.


You are overestimating its difficulty. It is actually the other way around: C and C++ are harder than Scheme since you have to deal with all kinds of silly syntax rules, inconsistencies (from the view of a Schemer), memory management, pointers and other diversions.

It is akin to writing a text in your favourite text editor versus writing a text in Word. The latter will distract you with mark-up, random auto-'correction' and other diversions I'm still repressing.

The best thing one can do is get The Little Schemer[1], download DrRacket[2] and go through the book.

[1] http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&...

[1.5] http://www.ccs.neu.edu/home/matthias/BTLS/

[2] http://www.racket-lang.org/download/


But after you learn C you have a ton of stuff to unlearn before you can use Scheme properly.


My school taught Haskell as the intro language to math majors, and my basic observation was that people who had never programmed before and people who where really good at programming already got it pretty quickly. On the other hand people in the middle that had programmed a bit before and where competent, but not great, where really confused and never really got it.

In the second half of the course, where you learnt Java and OO, was totally confusing to most those who'd just learnt Haskell as their first language and many people who got great grades on the Haskell part failed the Java part.

So it would seem that whatever you learn first is easy and normal and whatever you learn after that is confusing and difficult.


Scheme(or LISP dialects in general) is not just functional; it's multiparadigm. It sure is trippy, but gives a very solid foundation for later stages of academic and professional life.


> though I may be overestimating its difficulty.

The difficulty could be due to the brain damage C++ causes. Before I get incinerated, I have to remind you of Dijkstra quote about BASIC ("mutilates the mind beyond recovery").

Both BASIC and C++ (and Java, Smalltalk and so on) fixate several ideas about computing that make it harder to understand very different concepts. In a sense, that qualifies as mild brain damage.

I learned programming with BASIC on an Apple II+, went through FORTH (GraFORTH), C, Pascal, APL (The write-only language) and FORTRAN (in college) and later learned OOP with Smalltalk (and worked a bit with Actor). Did a lot of VB too (I had bills to pay), Perl, Java and Python. For obvious reasons, I don't completely agree with Dijkstra on the BASIC thing. I never liked C++ much, possibly because I learned OOP with Smalltalk and C++'s OOP seemed to me a misappropriation of the acronym. All things considered (it took me 8 years and a job offer to decide to learn C++) Smalltalk damaged me beyond recovery.


Incidentally, my school's (optional) introduction to programming course teaches Python.


That's a good way to create a generation that utterly hates Java ;-)


I made an abortive attempt to learn C++ by myself long ago, and was frankly scared of programming for a while because of it (was fine with BASIC, but.. a good idea of how I felt: http://www.qwantz.com/index.php?comic=1178).

But a couple months ago I decided to give it another go with Scheme and I have been pleasantly surprised by how much more natural it seems to me. I'm having fun!




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

Search: