Getting started with Clojure [closed]
I'm a relatively new person to programming, I've read the first half of SICP until I thoroughly ingrained it into every cell in my body, took a class implementing basic data structures in Java, and made programs in Mathematica. But that is about as far as my knowledge goes, which is my problem.
I'm trying to play with Clojure via netbeans/enclojure and, to be honest, I don't know how to get anything beyond constructing functions and manipulating data structures in the REPL.
For example, I want to use Incanter for statistics stuff, but I don't know how to install it since I have never really used a terminal (I'm using wi开发者_运维问答ndows vista), and don't know where to begin. When I search google, all the tutorials seem to assume knowledge with Unix, or they assume knowledge of how emacs works, etc.
I suppose what I am looking for is an online tutorial that covers the very basics of how to set everything up for a programming environment that doesn't assume previous knowledge.
Thanks,
Bryan
I'm relatively new to programming as well. My suggestion is that Unix or Linux are easier environments to program in. I know you said that you don't have experience with it, but you can pick up the basic commands in an afternoon. Learning basic Unix commands are going to be much, much easier than learning Java or Clojure, for example. The advantage is that once you have some basic familiarity with Unix/Linux then the rest of the environment becomes much simpler. This is a guide to Unix for someone who has never used it before: http://www.ee.surrey.ac.uk/Teaching/Unix/
A quick way to try it out would be to download Cygwin, which is a Unix emulator that runs in Windows. You can install this and then try out Unix. Also, when you install Cygwin, you get a list of languages and text editors that you can install with it, so setting up that environment becomes fairly easy: http://www.mcclean-cooper.com/valentino/cygwin_install/
I wouldn't suggest using Cygwin forever though, it'd just be a way to start out and see if you like programming in a Unix environment.
You can take some book that describes Clojure - for example, Practical Clojure first, and than - The Joy of Clojure - these books give you understanding of language.
About installing of plugins, etc. you can read on following page. Projects are usually maintained with Maven or Leiningen (I gave links to my articles). Dependencies, like Incanter are found through clojars, and put into project's files.
And clojure mailing list - good place where to ask questions...
Clojure is really fun, and managing the dependencies is not.
I think that using leiningen to create and build the project with its dependencies will help you skip to the fun part :) Leiningen from windows works just fine from what I hear though I dont see much advantage in trying to get away from the CLI. You should be fine sticking with windows and perhaps spending some time with the windows shell (or powershell) I hear a lot of good things about it.
ohh and another vote for the joy of clojure :)
If you are strict about using a windows environment, then I can recommend clojure box.
http://clojure.bighugh.com/
If you are flexible, I'd recommend setting up a virtual machine (with Virtualbox) and work in a *nix environment. Luckily, you may not have to do much since there are turnkey solutions with an editor, dependency management, and other tools configured and installed.
See http://technomancy.us/150
Some examples include: http://github.com/notifymd/vagrant-clojure-box http://github.com/Seajure/emacs-clojure-vagrant
A caveat, though, is that these do seem to depend on gem.
As a bonus, if you are willing to spend time learning a *nix, then I can also recommend my dependency management software. You should be able to use any editor for this, but I'm only familiar with emacs. If you tell me what you use, I should be able to help you set it up.
http://github.com/bmillare/dj
I like to keep it simple. For Netbeans, you need to import the Incanter JAR files as they are merely Java libraries. Do a search on how to add libraries to Netbeans. Once that's done, then you can use Incanter in Netbean's REPL.
Once you feel like learning more, follow the other people's advice here and learn Leiningen, command line interface, Linux, emacs, etc.
Unfortunately, setting up a development environment for Clojure is just about the hardest part of learning it. There is no single, canonical way to do it, as shown by all of the other answers to this question.
Another option you might consider is LispCabinet. Despite its name, one of the options it provides is to set up a Clojure programming environment. A couple of advantages of this approach are that 1) it works in Windows, 2) its an Emacs environment, since a lot of the tutorials you find talk about how to do things with that editor, and 3) it makes it easy to explore and play with other, more traditional Lisps like CLISP and SBCL.
I too started with NetBeans and enclojure. I dearly love NetBeans for Java and PHP, but enclojre just doesn't seem stable. It's constantly breaking. So I gave up on it.
There are also plugins for IDEA and Eclipse if you prefer those environments.
But really, I recommend LispCabinet. You can see a slightly longer rationale on my blog at http://clarkonium.net/2011/02/getting-started-with-lispschemeclojure/.
精彩评论