I am interested in learning clojure. Unfortunately the learning material online is very scanty.
Also the material is very dry. If you have never programmed in a Lisp language before it all looks greek and latin. This tends to be a problem with most Lisp books. They very soon go into the great aspects of Lisp.
As a beginner, I need to be shown how to do the regular stuff in Lisp. Like other languages tutorials.
One of the reason I like Python is really for the awesome documentation on their website.
Now the thing about clojure, is due to sheer interest and passion alone. I am being forced to take additional pain to continuously search and learn. Others may not do the same. If the barrier to entry is too high, you will scare away new comers. Especially Lisp new comers.
All Advanced Hackery is OK, but teach me the basic stuff first. I need to learn the if/else, for/do/while , functions, IO, regular expressions, Battery usage, socket etc kind of stuff.
After I'm through with this, you can rant as much about macros as you want, and I'm all ears.
But directly going to all this advanced hackery without me even knowing how to do my day-to-day tasks is what has kept Lisp in the lower side of usage.
> Unfortunately the learning material online is very
scanty.
> All Advanced Hackery is OK, but teach me the basic stuff
first.... If the barrier to entry is too high, you will
scare away new comers.
I attempted to address that very need in one of my blog posts http://blackstag.com/blog.posting?id=5 and there are many other community contributions listed here: http://blackstag.com/blog.posting?id=23. Personally I think there has been an overwhelming amount of community contribution - to a point I would find it difficult to agree with your comments.
> As a beginner, I need to be shown how to do the regular stuff in Lisp. Like other languages tutorials.
The problem is that a very basic, idiomatic solution to an everyday problem in a lisp will utilize things like recursion, macros or higher order functions that you really need to understand first. Lisp is not just another programming language, it is another genre of programming language and you need to spend a bit of time understanding the fundamentals before digging into code. Otherwise it'd be like trying to learn Java without knowing what a class is.
So, most Clojure tutorials intended for non-lisp programmers start with language basics. I agree that there's a slight shortage of "cookbook-style" Clojure tutorials/examples out there, but most people find that once they "get" Clojure, via the basic tutorials, it's fairly straightforward to read and write. The lack of exampless for particular tasks doesn't seem to be an obstacle for most people.
> I am interested in learning clojure. Unfortunately the learning material online is very scanty.
You might give 4Clojure a try[1]. It's a series of programming problems that in the process of challenging you attempt to teach you the syntax and usage. It starts off very basic so even if you know no programming at all it may still be useful.
From the link you just gave. The emphasis seems to be more on teaching mathematics through programming.
Do you seriously expect me or any other serious programmer in a business environment sorting a million integers in a million different ways?
How do I open files, how do I search what I want through regexps? How do write back? How can I build socket based programs? How can I interact with databases? How can write to log files? How can I work with business logic? How do I interact with webservices? API's? How to I work with operating system commands? etc stuff.
I make a living programming for those sort of stuff and wish to leverage any language in that direction.
Perl, Python tutorials teach me to do real work in a real production environment now. Not mathematics for my college assignments.
I hope you are able to understand. If that stuff is absent, I have to now take the pain of figuring that out myself.
Everyone else already said it, but you are completely dead wrong. Very little of the stuff on 4Clojure has anything to do with mathematics. It is about teaching you the standard library, concepts which are as common and fundamental in Clojure as std::map is in C++ or as list comprehensions are in Python. Without learning the stuff on 4Clojure, you will not be able to productively do anything with the data that comes back from the database, or transform data for delivery to a web service.
You can criticize it for being too much to learn, if you like, and keep writing Perl and Python. That might be a fair criticism, insofar as it would be nice to have a better-paved road to mastery coming from the land of imperative languages. But you can't criticize it for being abstract or unnecessary for programming in Clojure. It is not.
> Do you seriously expect me or any other serious programmer in a business environment sorting a million integers in a million different ways?
Well my apologies for not immediately understanding your specific situation... I can assure you I meant it as a kind suggestion.
Perhaps you could look at Clojure In Action[1]? It's supposed to be a pragmatic introduction for people with some existing programming experience. From the Amazon page, "is a hands-on tutorial for the working programmer who has written code in a language like Java or Ruby, but has no prior experience with Lisp."
You might learn that if you want to learn any of those things in clojure understanding these concepts really help. The librarys of clojures are all build on these functional concepts. You will have a much harder time understanding the librarys if you think you can only look at how to call some api. All the business logic that I write in Clojure uses these concepts, there is a reason for this stuff.
Clojure is not python and not java, the fundamental concept is diffrent. If you allready understand these concepts just go to github and look at the librarys for logging, databases and other stuff. How to use a library you can learn looking at the documentation of the library, learning how to programm idiomatic clojure needs some training.
man you're far away to be a good programmer..you first need learn how thinking and how convert your ideas to code and then you can learn the simple stuff (open files, search through regexps) I learned first ruby, python and javascript and know I'm learnig haskell and clojure...learning any functional language is very different to the rest...you need how think and how express it in a functional way...that's the hard part..but when you learn this then write ANY code is so simple, elegant and expressive...4clojure and functional lang don't intend teach you how program: they intend you learn how think in a different way than let you write faster, elegant and explicit code (you can resolve any problem in 4clojure using your knwledge in javascript or python and writing the code using procedural algorithms, but you will notice than thats way is ugly, more verbose and less clear
"Do you seriously expect me or any other serious programmer in a business environment sorting a million integers in a million different ways?" well...Yes!!...today almost any app need than you work with thousand data...unless your goal be write javascript widgets or client side apps..you will need know how work with big data, how transform this and analize it...
I work with ruby, javascript (and coffeescript) and now I'm using clojure and haskell..and now I'm impressed how I can write many things than in imperative or procedural langs could take many lines in functional langs it takes me 2 or 3 lines..and they are very clear and self explicit
You need to learn enough Java to get around, and how to interact with it through Clojure. Java libraries are very comprehensive and well documented, but if you're fresh to both languages the learning curve is steep.
It's sorta possible to get around with pure Clojure, but not very practical.
Leiningen is the de-facto package manager so use that for everything. Clojars and Maven are the two repositories.
Others have pointed out that you need to understand sequences and other basic Clojure stuff first but perhaps my "real world Clojure" blog post series will give you a quick tour of the sort of things you're looking for?
I think it's a good way to get acquainted with the general use and syntax.
Right now I'm implementing resolutions for problems from Project Euler (http://projecteuler.net/) as a more hand-on practice.
>> All Advanced Hackery is OK, but teach me the basic stuff first. I need to learn the if/else, for/do/while , functions, IO, regular expressions, Battery usage, socket etc kind of stuff.
Keep in mind that Clojure/Lisp comes from a functional paradigm and so you won't find a lot of constructs that you might think are the starting points in imperative languages.
So if you come from an imperative language, like me, learning Clojure is not just learning Clojure, but a bigger dive in a different programming paradigm too.
..to been a nice soft introduction. Now I'm intending to go through The Joy Of book, but with more familiarity than last time I tackled it (and fell flat on my face!).
Yes, it's dry, but it's also very straightforward. Using the repl in another window while looking it over was key though. It really does become much more clear what's going on when you manually type everything out, and then poke bits of it with a stick until it clicks.
The Joy Of book, but with more familiarity than last time I tackled it (and fell flat on my face!)
I am facing the same problem. I tend to run into that problem, because the moment I see some non regular programming aspect being discussed at length it becomes a little boring. Also I can't co relate that with my practical experiences.
I enjoyed functional programming thanks to Mark Jason Dominus's "Higher Order Perl". Which taught me all functional programming stuff in the most pragmatic way out.
Now that is what I look for, material that teaches me all this great stuff in the framework of my real work. Then it becomes really enjoyable and graspable.
Just glancing through, these look like great problems to tackle while learning any new language, and I might have a go at just that - translating them to clojure, and looking at docs as I go. If you're interested in doing something similar, my mail is my name at gmail. (You probably know the material a lot better than I though!)
I've found a multi book approach to be helpful. Safari online has both Practical Clojure and The Joy of Clojure available. Manning has Clojure in Action -- with the ebook version including drm free mobi, ePub, and PDF versions.
This is the first lisp that has started to click for me.
The thing is that in functional programming, you don't do a lot of things that you think are essential for programming, such as "for/do/while". A lot of people need to do exercises to truly grasp the new way of doing things. Basically, one has to unlearn imperative habits, which is really hard without sites like 4clojure.com.
The thing is, these are different in Clojure than in various other languages (although more in common with other Lisps). Constructs like "if" are expressions which return values, which will confuse you the first time it comes up if you don't realize that everything is an expression.
Then there's "for/do/while", where "for" in Clojure is not a loop at all because it produces a lazy sequence. And the equivalent to "do/while" (loop/recur, which enforces tail recursion) is something of a last resort where other sequence functions have failed.
I agree with you 100% that the learning material is a little dry. I don't know what kind of material would work best...
> you will scare away new comers. Especially Lisp new comers.
I had some background in sundry Lisps, but my stumbling block was my lack of knowledge about the JVM and things Java. You really do need some experience in the ecosystem, else Clojure discussions about boxing, interfaces, AOT, stack traces, what-have-you will be mystery meat.
There's a very finite amount of stuff you need to pick up and this is common to JRuby, groovy, scala too. Remember you can ask questions on Stackoverflow, IRC (freenode #clojure, google group, folks are supportive. Re: JVM for non-java programmers:
Addendum: My recent pain point was downloading a self-extracting JDK installer from oracle's site, and it wouldn't extract. Also, the hotspot switches are not exactly very finite amounts of time to benchmark, but most people seem to bump the defaults for MaxInlineSize, Xmx, Xss, and Xms
Clojure is on my list of languages to learn in 2012. I really dig the community and the fact that it runs on the JVM. I've been looking for a strong functional language to use for backends as an alternative to using Node, and Clojure seems to be the right fit for that.
http://www.webnoir.org http://www.sqlkorma.com