hello clojure | 阿小信的博客
阿小信大人的头像
Life is short (You need Python) Bruce Eckel

hello clojure2016-03-16 16:45

install jdk

download and install jdk: http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-macosx-x64.dmg

install lein

brew install leiningen

new project

lein new myapp

project tree

myapp
├── LICENSE
├── README.md
├── doc
│   └── intro.md
├── project.clj
├── resources
├── src
│   └── myapp
│       └── core.clj
└── test
    └── myapp
        └── core_test.clj

in myapp.core:

(ns myapp.core)

(defn foo
  "I don't do a whole lot."
  [x]
  (println x "Hello, World!"))

add :main keyword in project.clj:

(defproject myapp "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]]
  :main myapp.core/foo)

go:

lein run axiaoxin
axiaoxin Hello, World!

start a repl

lein repl
(println "hello world")

docs:

https://clojuredocs.org/quickref

http://clojure-api-cn.readthedocs.org/en/latest/index.html

如果您觉得从我的分享中得到了帮助,并且希望我的博客持续发展下去,请点击支付宝捐赠,谢谢!

若非特别声明,文章均为阿小信的个人笔记,转载请注明出处。文章如有侵权内容,请联系我,我会及时删除。

#Clojure#  
分享到:
阅读[1161] 评论[2]

本文最近访客

发表评论

#1 大鹌鹑60.*.*.18[天津]28089 :
学习了
2016-03-23 18:45 回复