1、文件下载
git clone https://github.com/clojure/clojure
2、文件的安装、配置
* Clojure * Copyright (c) Rich Hickey. All rights reserved. * The use and distribution terms for this software are covered by the * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) * which can be found in the file epl-v10.html at the root of this distribution. * By using this software in any fashion, you are agreeing to be bound by * the terms of this license. * You must not remove this notice, or any other, from this software. Docs: http://clojure.org Feedback: http://groups.google.com/group/clojure Getting Started: http://dev.clojure.org/display/doc/Getting+Started To run: java -cp clojure-${VERSION}.jar clojure.main To build locally with Ant: One-time setup: ./antsetup.sh To build: ant Maven 2 build instructions: To build: mvn package The built JARs will be in target/ To build without testing: mvn package -Dmaven.test.skip=true To build and install in local Maven repository: mvn install To build a ZIP distribution: mvn package -Pdistribution The built .zip will be in target/ -------------------------------------------------------------------------- This program uses the ASM bytecode engineering library which is distributed with the following notice: Copyright (c) 2000-2005 INRIA, France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mvn package -Dmaven.test.skip=true
生成三个文件:
clojure-1.7.0-master-SNAPSHOT-slim.jar
clojure-1.7.0-master-SNAPSHOT-sources.jar
clojure-1.7.0-master-SNAPSHOT.jar
java -cp clojure-1.7.0-master-SNAPSHOT.jar clojure.main
入门学习:
➜ target git:(master) java -cp clojure-1.7.0-master-SNAPSHOT.jar clojure.mainClojure 1.7.0-master-SNAPSHOT user=> ; user=> (+ 1 2 3) 6 user=> (javax.swing.JOptionPane/showMessageDialog nil "IT") nil user=> (class 1) java.lang.Long user=> (class "") java.lang.String user=> (eval '(+ 1 2)) 3 user=> (class [1 2 3]) clojure.lang.PersistentVector user=> (range 4) (0 1 2 3) user=> (map inc [1 2 3]) (2 3 4) user=> (reduce + [1 2 3 4]) 10 user=> (fn hello-world (fn [] "Hello,world")) CompilerException java.lang.IllegalArgumentException: Parameter declaration fn should be a vector, compiling:(NO_SOURCE_PATH:11:1) user=> (def hello-world (fn [] "hello,world")) #'user/hello-world user=> hello-world #<user$hello_world user$hello_world@351672ae> user=> (hello-world) "hello,world" user=> (defn hello [name] CompilerException java.lang.RuntimeException: Unable to resolve symbol: (defn in this context, compiling:(NO_SOURCE_PATH:0:0) CompilerException java.lang.RuntimeException: Unable to resolve symbol: hello in this context, compiling:(NO_SOURCE_PATH:0:0) [#<core$name clojure.core$name@42593848>] user=> (defn hello [name] \ (str "hello" name)) \ #'user/hello (hello "jim") \newline user=> "hellojim" user=> (hello "li") "helloli" user=> (class {:a 1 :b 2}) clojure.lang.PersistentArrayMap user=> (def stringmap(hash-map "a" 1, "b" 2,"c" 3)) #'user/stringmap user=> stringmap {"a" 1, "b" 2, "c" 3} user=> (stringmap "a") 1 user=> (if false "a" "b") "b" user=> (let [a 1 b 2] (> a b)) false user=> (do (print "hello") "world") hello"world" user=> (let [name "li"] (print "saying hello to " name) (str "hello" name)) saying hello to li"helloli" user=> (use '[clojure.set :only[intersection]]) nil user=> (require 'clojure.string) nil user=> (import java.util.Date) java.util.Date user=> (ns test (:import java.util.Date java.util.Calendar)) nil test=> (Date.) #inst "2014-05-21T06:02:15.938-00:00" test=> (.(Date.) getTime) 1400652147748 test=> (.getTime (Date.)) 1400652160397 test=> %
5、另外,跑完之后才发现,又专门的mac下安装配置clojure和leiningen的方法
https://gist.github.com/rakhmad/2407109
6、附加有一篇很简单上手的学习入门资料
http://www.oschina.net/translate/learn-clojure-in-minutes
http://clojure.org/getting_started
参考:http://blog.csdn.net/ithomer/article/details/17225813
官方文档:
http://clojure.org/documentation
中文资料(强烈推荐):
1. clojure入门教程
http://xumingming.sinaapp.com/302/clojure-functional-programming-for-the-jvm-clojure-tutorial/
2. clojure文档翻译
http://code.google.com/p/clojure-doc-en2ch/w/list
3. clojure手册(低版本)
http://qiujj.com/static/clojure-handbook.html
4. clojure中文社区:
http://blog.clojure.cn/
5. Lisp中文社区:
http://www.lispchina.com/
英文资料(强烈推荐):
http://clojure-doc.org/articles/content.html
clojure 开源工具:
clojure工具箱汇总:
http://www.clojure-toolbox.com/
ring server:
https://github.com/ring-clojure/ring/wiki
compojure:
https://github.com/weavejester/compojure/wiki
noir web框架:
http://www.webnoir.org
sandbar session框架:
https://github.com/brentonashworth/sandbar/wiki
clojureQL连接数据库:
http://www.clojureql.org/
datomic数据库:
http://www.datomic.com/
fleetdb数据库:
http://fleetdb.org/
https://github.com/mmcgrana/fleetdb-client
pdf处理:
https://github.com/yogthos/clj-pdf
csv处理:
https://github.com/clojure/data.csv
json库:
https://github.com/dakrone/cheshire
https://github.com/mmcgrana/clj-json
mail库:
https://github.com/clojurewerkz/mailer
https://github.com/MayDaniel/clj-mail
图形处理库:
https://github.com/mikera/clisk
https://github.com/ztellman/penumbra/wiki/Applications
https://github.com/quil/quil
音频处理库:
https://github.com/overtone/overtone
报表工具库:
http://incanter.org/
定时任务框架:
http://clojurequartz.info
webservices
http://clojure-liberator.github.com