欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Clojure
小 (→Clojars) |
小 (→IDE和Editor) |
||
(未显示1个用户的166个中间版本) | |||
第1行: | 第1行: | ||
− | |||
{{SeeWikipedia}} | {{SeeWikipedia}} | ||
− | Clojure 是一个面向[[Java Virtual Machine]] | + | Clojure |
+ | |||
+ | [[文件:clojure-logo.png|right]] | ||
+ | |||
+ | ==简介== | ||
+ | [[文件:clojure-logo-120b.png|right]] | ||
+ | Clojure 是一个面向[[Java Virtual Machine|JVM]] 动态的通用编程语言,采用 Eclipse Public License 1.0 许可证。 | ||
[[Lisp]] 是一种编程语言,以表达性和功能强大著称,但人们通常认为它不太适合应用于一般情况。Clojure 是一种运行在 [[Java]]平台上的 Lisp 方言,它的出现彻底改变了这一现状。如今,在任何具备 Java 虚拟机的地方,您都可以利用 Lisp 的强大功能。 | [[Lisp]] 是一种编程语言,以表达性和功能强大著称,但人们通常认为它不太适合应用于一般情况。Clojure 是一种运行在 [[Java]]平台上的 Lisp 方言,它的出现彻底改变了这一现状。如今,在任何具备 Java 虚拟机的地方,您都可以利用 Lisp 的强大功能。 | ||
+ | |||
+ | Clojure is about Data, [[Scala]] is about Types, [[Java]] is about Objects. | ||
+ | |||
+ | [https://blog.cleancoder.com/uncle-bob/2019/08/22/WhyClojure.html Why Clojure?] | ||
+ | |||
+ | ==版本== | ||
+ | [https://clojure.org/about/history A History of Clojure] | ||
+ | |||
+ | ==功能== | ||
+ | |||
+ | ==编译器== | ||
+ | [[文件:SCI-logo.png|right|SCI]] | ||
+ | *[https://github.com/clojure/clojure-clr ClojureCLR] 基于 Microsoft Dynamic Language Runtime (DLR) 和.NET Common Language Runtime (CLR),[[C Sharp|C#]] 和 Clojure 编写。 | ||
+ | *[[ClojureScript]] | ||
+ | *[https://github.com/babashka/sci Small Clojure Interpreter (SCI)] | ||
+ | |||
+ | ==语言== | ||
+ | [[文件:Clojerl-logo.png|right|Clojerl]] | ||
+ | *[https://github.com/clj-python/libpython-clj Python bindings for Clojure] | ||
+ | *[https://www.clojerl.org/ clojerl: Clojure for the Erlang VM] | ||
+ | 由[[Clojure]]开发的编程语言: | ||
+ | *[https://github.com/jeaye/jank jank] | ||
+ | *[https://github.com/LuxLang/lux lux] | ||
+ | *[https://github.com/kanaka/mal/tree/master/clojure mal] | ||
+ | *[https://github.com/turbopape/scheje scheje] | ||
+ | |||
==指南== | ==指南== | ||
− | wget | + | 通过 [[Leiningen]] 安装是推荐方式 |
+ | |||
+ | [https://www.baeldung.com/clojure Introduction to Clojure] | ||
+ | wget https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0.jar | ||
java -cp clojure-1.8.0.jar clojure.main | java -cp clojure-1.8.0.jar clojure.main | ||
user=> (+ 1 2 3) | user=> (+ 1 2 3) | ||
第14行: | 第48行: | ||
user=> (hello) | user=> (hello) | ||
"Hello world" | "Hello world" | ||
+ | 或使用 [[Leiningen]] REPL,它比 Clojure 自带的 REPL 好很多。 | ||
+ | lein repl | ||
+ | Web应用启动: | ||
+ | lein run 或 lein ring server | ||
+ | |||
+ | ==Evaluation== | ||
+ | [[文件:traditional-evaluation.png]] [[文件:clojure-evaluation.png]] | ||
+ | |||
+ | ==Windows== | ||
+ | [https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows clj on Windows] | ||
+ | |||
+ | C:\huihoo\clojure>powershell -noprofile -executionpolicy bypass -file .\win-install-1.10.1.469.ps1 | ||
+ | |||
+ | PS C:\huihoo\clojure> clj -h | ||
+ | |||
+ | PS C:\huihoo\clojure> clj -r | ||
+ | Clojure 1.10.1 | ||
+ | user=> | ||
− | == Leiningen== | + | ==Leiningen== |
− | 使用[ | + | 使用[[leiningen]]工具来管理Clojure项目和Java配置。 |
brew install leiningen | brew install leiningen | ||
第24行: | 第76行: | ||
cd bin,执行 ./lein // 开始安装 Leiningen | cd bin,执行 ./lein // 开始安装 Leiningen | ||
− | + | lein help | |
− | + | lein help $TASK for details. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
接着: | 接着: | ||
第64行: | 第89行: | ||
Give me some Clojure! | Give me some Clojure! | ||
nil | nil | ||
+ | |||
+ | ===插件=== | ||
+ | [https://github.com/technomancy/leiningen/wiki/Plugins Leiningen Plugins] | ||
+ | |||
+ | ==fn,def,defn== | ||
+ | [https://clojuredocs.org/clojure.core/fn fn] [https://clojuredocs.org/clojure.core/def def]和[https://clojuredocs.org/clojure.core/defn defn] | ||
+ | |||
+ | defn builds on fn,defn是一个宏,它封装了def和fn的功能。 | ||
+ | |||
+ | fn 创建一个匿名函数,fn 和 lambda 类似。 | ||
+ | user=> (map (fn [x] (* x x))) | ||
+ | def 可以将一个匿名函数绑定到一个name上。 | ||
+ | user=> (def my-function (fn [x] (* x x ))) | ||
+ | defn 是 def 与 fn 的简写。 | ||
+ | user=> (defn my-function [x] (* x x)) | ||
==Clojars== | ==Clojars== | ||
第69行: | 第109行: | ||
*[https://clojars.org/search?q=lein-template Third-party templates] | *[https://clojars.org/search?q=lein-template Third-party templates] | ||
− | == | + | ==大数据== |
+ | *[[Apache Storm]] | ||
+ | *[https://github.com/nathanmarz/cascalog Cascalog], 基于[[Apache Hadoop]]的数据处理。 | ||
+ | *[https://github.com/onyx-platform/onyx Onyx] | ||
+ | *[https://github.com/gorillalabs/sparkling Sparkling] - A Clojure API for [[Apache Spark]] | ||
+ | *[https://github.com/Netflix/PigPen PigPen] Map-Reduce for Clojure | ||
+ | |||
+ | ==数据分析== | ||
+ | 统计、数据分析和商业智能 | ||
+ | *[[Incanter]] | ||
+ | *[[Metabase]] | ||
+ | |||
+ | ==机器学习== | ||
+ | *[https://github.com/antoniogarrote/clj-ml clj-ml] | ||
+ | *[[deeplearning4j]] | ||
+ | *[https://github.com/nuroko/nurokit nurokit] Toolkit for [[machine learning]] in Clojure. | ||
+ | *[https://github.com/gigasquid/k9 k9] | ||
+ | |||
+ | ==计算机视觉== | ||
+ | *[https://github.com/nakkaya/vision OpenCV wrapper for Clojure] | ||
+ | *[https://github.com/antoniogarrote/clj-tesseract clj-tesseract] | ||
+ | |||
+ | ==自然语言处理== | ||
+ | *[https://github.com/dakrone/clojure-opennlp clojure-opennlp] | ||
+ | |||
+ | ==消息通信== | ||
+ | *[http://clojurerabbitmq.info/ Langohr] | ||
+ | *[https://github.com/clojurewerkz/machine_head Machine Head], a Clojure [[MQ Telemetry Transport|MQTT]] Client | ||
+ | *[https://github.com/lynaghk/zmq-async ZeroMQ Async] | ||
+ | |||
+ | ==事件CEP== | ||
+ | *[https://github.com/clojurewerkz/eep EEP] Embedded Event Processing in Clojure | ||
+ | *[https://github.com/clojurewerkz/meltdown Meltdown] a Clojure Interface to Reactor | ||
+ | |||
+ | ==并行并发== | ||
+ | *[https://github.com/ptaoussanis/clojure-web-server-benchmarks Clojure web server benchmarks] | ||
+ | *[https://github.com/puniverse/pulsar pulsar]: [[Actor model]] 实现 | ||
+ | *[https://github.com/clojure/core.async/ core.async] Go式轻量级线程,⻓得像同步的异步. | ||
+ | *[https://github.com/liebke/avout Avout]: Distributed State in Clojure | ||
+ | |||
+ | ==金融货币== | ||
+ | *[https://github.com/clojurewerkz/money ClojureWerkz Money] a Clojure Library to Work With Money | ||
+ | |||
+ | ==验证授权== | ||
+ | *[https://github.com/jgrodziski/keycloak-clojure keycloak-clojure] [[Keycloak]] [[文件:keycloak-plus-clojure.png|right]] | ||
+ | *[[Friend]] | ||
+ | *[https://github.com/clojurewerkz/scrypt Clojure Scrypt Library] | ||
+ | *[https://github.com/funcool/buddy Buddy] - Security library for clojure. | ||
+ | |||
+ | ==数据库存储== | ||
+ | *[[Datomic]] | ||
+ | *[https://github.com/tonsky/datascript DataScript] | ||
+ | *[http://clojurewerkz.org/ Clojure libraries for MongoDB, RabbitMQ, validations, Neo4J, ElasticSearch, Apache Cassandra, Riak, Memcached, stream processing] | ||
+ | *[https://github.com/tomekw/hikari-cp hikari-cp] 连接池 | ||
+ | *[https://github.com/duelinmarkers/clj-record clj-record] 类似 Ruby on Rails ActiveRecord | ||
+ | *[https://github.com/puppetlabs/puppetdb PuppetDB] | ||
+ | |||
+ | ===SQL=== | ||
+ | *[https://github.com/korma/Korma Korma] Tasty SQL for Clojure | ||
+ | *[https://github.com/seancorfield/honeysql Honey SQL] Turn Clojure data structures into SQL | ||
+ | *[https://github.com/krisajenkins/yesql yesql] https://github.com/krisajenkins/yesql | ||
+ | |||
===PostgreSQL=== | ===PostgreSQL=== | ||
===MongoDB=== | ===MongoDB=== | ||
+ | [http://clojuremongodb.info/ Clojure Monger], [https://github.com/michaelklishin/monger Monger @ GitHub] | ||
===Cassandra=== | ===Cassandra=== | ||
+ | *[https://github.com/clojurewerkz/cassaforte cassaforte] 建议:暂不使用高版本Cassandar,因为可能不支持。 | ||
*[https://github.com/mpenet/alia alia]: High performance Cassandra client for clojure | *[https://github.com/mpenet/alia alia]: High performance Cassandra client for clojure | ||
*[https://github.com/mpenet/hayt hayt]: CQL3 DSL for Clojure | *[https://github.com/mpenet/hayt hayt]: CQL3 DSL for Clojure | ||
+ | |||
+ | ===Redis=== | ||
+ | *[https://github.com/ptaoussanis/carmine Carmine] | ||
===HBase=== | ===HBase=== | ||
+ | |||
+ | ===BI=== | ||
+ | *[[Metabase]] | ||
+ | |||
+ | ===Elasticsearch=== | ||
+ | *[http://clojureelasticsearch.info/ Elastisch] | ||
+ | |||
+ | ==Web HTTP== | ||
+ | *[[ring]] | ||
+ | *[[Compojure]] | ||
+ | *[https://github.com/dakrone/clj-http clj-http] | ||
+ | *[https://github.com/http-kit/http-kit http-kit] | ||
+ | *[https://github.com/ztellman/aleph aleph] built on top of [[Netty]] | ||
+ | *[https://github.com/dakrone/cheshire Cheshire] | ||
+ | *[https://github.com/brehaut/necessary-evil necessary-evil] [[XML-RPC]] | ||
+ | *[https://github.com/nginx-clojure/nginx-clojure nginx-clojure] | ||
+ | *[https://github.com/pedestal/pedestal Pedestal] | ||
+ | *[https://github.com/weavejester/hiccup Hiccup] | ||
+ | |||
+ | ==RESTful API== | ||
+ | *[https://github.com/metosin/compojure-api compojure-api] with [https://github.com/weavejester/compojure Compojure] & [[Swagger]] | ||
+ | *[https://github.com/clojure-liberator/liberator/ liberator] | ||
+ | *[https://github.com/metosin/ring-swagger ring-swagger], Swagger Spec for Clojure Web Apps | ||
+ | *[https://github.com/RJMetrics/sweet-liberty Sweet-Liberty] | ||
+ | |||
+ | ==IDE和Editor== | ||
+ | *[[logseq]] 写作平台 | ||
+ | *[https://github.com/clojure-emacs/cider CIDER] extends [[GNU Emacs]] is the Clojure(Script) Interactive Development Environment that Rocks! | ||
+ | *[[Light Table]] | ||
+ | *[https://github.com/oakes/Nightcode Nightcode] | ||
+ | *[[Cursive|Cursive IDE]] | ||
+ | *[[CCW IDE]] | ||
+ | *[https://github.com/oakes/Nightcode Nightcode] | ||
+ | *[https://github.com/arthuredelstein/clooj clooj], a lightweight IDE for clojure | ||
+ | *[https://github.com/bodil/catnip Catnip], A web based Clojure IDE | ||
+ | *[https://github.com/clojure-emacs clojure-emacs] for [[Emacs]] | ||
+ | *[http://clojure-doc.org/articles/tutorials/emacs.html Clojure with Emacs] | ||
+ | *[https://github.com/wuub/SublimeREPL SublimeREPL for SublimeText] | ||
+ | *[https://github.com/tpope/vim-fireplace fireplace.vim]: Clojure REPL support | ||
+ | |||
+ | ==GUI== | ||
+ | *[https://github.com/daveray/seesaw Seesaw] | ||
+ | *[https://github.com/cljfx/cljfx Cljfx] | ||
==项目== | ==项目== | ||
+ | [https://github.com/razum2um/awesome-clojure Awesome Clojure] [[image:awesome.png]] | ||
+ | [[文件:Status-logo.png|right|Status]] | ||
+ | *[https://github.com/clojure Clojure @ GitHub] | ||
+ | *[https://github.com/clojurewerkz ClojureWerkz]团队开发了众多开源项目 | ||
+ | *[https://github.com/status-im Status] A Mobile [[Ethereum]] Client. | ||
*[[Apache Storm]] | *[[Apache Storm]] | ||
+ | *[https://github.com/Raynes/tryclojure tryclojure] | ||
*[[ClojureScript]] | *[[ClojureScript]] | ||
+ | *[https://github.com/clojure/test.check test.check] [https://github.com/BurntSushi/quickcheck QuickCheck] for Clojure | ||
*[[incanter]] | *[[incanter]] | ||
+ | *[[Ring]] | ||
+ | *[[Compojure]] | ||
+ | *[https://github.com/robashton/cravendb CravenDB]文档数据库 | ||
+ | *[https://github.com/circleci/frontend CircleCI's frontend] | ||
+ | *[[Enlive]] | ||
+ | *[https://github.com/macourtney/Conjure Conjure] A Rails like framework for Clojure. | ||
+ | *[http://boot-clj.com/ Boot]: Build tooling for Clojure | ||
+ | *[[cljsjs]] | ||
+ | *[https://github.com/alda-lang alda] 音乐编程语言 | ||
+ | *用 [[overtone]] 来演奏歌曲 | ||
+ | *[https://github.com/plumatic/schema schema] 数据描述与验证 | ||
+ | *[https://github.com/ptaoussanis/timbre Timbre] 日志库 | ||
+ | *[https://github.com/zcaudate/cronj cronj] cron for clojure | ||
+ | *[https://github.com/kyleburton/clj-bloom clj-bloom] | ||
+ | *[https://github.com/cognitect Cognitect] [https://github.com/cognitect-labs Cognitect Labs] | ||
==文档== | ==文档== | ||
第89行: | 第260行: | ||
*[http://docs.huihoo.com/infoq/qconbeijing/2015/day1/scala-v-clojure.pdf Scala v. Clojure] | *[http://docs.huihoo.com/infoq/qconbeijing/2015/day1/scala-v-clojure.pdf Scala v. Clojure] | ||
*[http://docs.huihoo.com/infoq/qconbeijing/2015/day2/scala-clojure-playing-nice.pptx Scala & Clojure
Playing Nice] | *[http://docs.huihoo.com/infoq/qconbeijing/2015/day2/scala-clojure-playing-nice.pptx Scala & Clojure
Playing Nice] | ||
+ | |||
+ | ==图书== | ||
+ | *[https://github.com/clojure-cookbook/clojure-cookbook Clojure Cookbook] | ||
==用户== | ==用户== | ||
− | * | + | *[http://cognitect.com/ Cognitect], Clojue之父,[https://github.com/richhickey Rich Hickey] 是该公司Co-Founder & CTO。 |
+ | *花旗信用实时风险估值系统Java/Clojure后端(1500节点分布计算)花旗投资信用部实时风险计算系统,逻辑使用Clojure。 | ||
*[[Puppet]]: [https://github.com/puppetlabs/puppet-server Puppet Server], [https://github.com/puppetlabs/trapperkeeper Trapperkeeper], [https://github.com/puppetlabs/puppetdb PuppetDB], [https://github.com/puppetlabs/trapperkeeper-webserver-jetty9 Trapperkeeper Webserver Service] | *[[Puppet]]: [https://github.com/puppetlabs/puppet-server Puppet Server], [https://github.com/puppetlabs/trapperkeeper Trapperkeeper], [https://github.com/puppetlabs/puppetdb PuppetDB], [https://github.com/puppetlabs/trapperkeeper-webserver-jetty9 Trapperkeeper Webserver Service] | ||
+ | *沃尔玛: “Our Clojure system just handled its first Walmart black Friday and came out without a scratch.” - Walmart Labs | ||
*[http://riemann.io/clojure.html Riemann] | *[http://riemann.io/clojure.html Riemann] | ||
*[https://blog.leancloud.cn/1954/ LeanCloud] 采用了多种语言混合来构建整个后端系统,包括 Clojure、Java、Node.js、Scala 等。其中 Clojure 构建了整个网站门户、存储开放 API、推送、聊天等核心服务,Node.js构建了云端代码服务(类似应用代码托管),我们还使用 Scala 编写的 Spark 任务来处理离线数据分析,此外,还有大量的统计类 MapReduce 任务使用 Java 编写并运行在 Hadoop 集群上。不同服务之间使用 RESTful 协议、RPC 框架或者队列进行通信。 | *[https://blog.leancloud.cn/1954/ LeanCloud] 采用了多种语言混合来构建整个后端系统,包括 Clojure、Java、Node.js、Scala 等。其中 Clojure 构建了整个网站门户、存储开放 API、推送、聊天等核心服务,Node.js构建了云端代码服务(类似应用代码托管),我们还使用 Scala 编写的 Spark 任务来处理离线数据分析,此外,还有大量的统计类 MapReduce 任务使用 Java 编写并运行在 Hadoop 集群上。不同服务之间使用 RESTful 协议、RPC 框架或者队列进行通信。 | ||
+ | [http://cognitect.com/clojure 更多用户>>>] | ||
+ | |||
+ | ==图集== | ||
+ | <gallery> | ||
+ | image:castra-rpc-for-clojure-architecture.png|Castra RPC | ||
+ | image:cursive-ide.png|Cursive IDE | ||
+ | image:clojure-tools.png|Tools | ||
+ | image:clojure-structure-and-semantics.png|Expression | ||
+ | image:clojure-dev-process.png|开发工作流 | ||
+ | image:cider-architecture.png|CIDER架构 | ||
+ | image:re-frame-event-dispatch.png|re-frame | ||
+ | image:re-frame-handling-one-event.png|re-frame | ||
+ | image:re-frame-interceptors.png|re-freme拦截器 | ||
+ | image:transit-overview.png|Transit | ||
+ | image:logseq-graph.png|logseq | ||
+ | image:clojerl-windows.png|clojerl,Clojure on Erlang VM | ||
+ | |||
+ | </gallery> | ||
==链接== | ==链接== | ||
*[http://clojure.org/ Clojure官网] | *[http://clojure.org/ Clojure官网] | ||
− | *[ | + | *[http://qiujj.com/static/clojure-handbook.html Clojure Handbook] |
− | *[ | + | *[http://blog.cognitect.com/blog/?tag=Clojure Clojure Blog] |
+ | *[http://planet.clojure.in/ Planet Clojure] | ||
+ | *[https://clojars.org/ Clojars] | ||
+ | *[http://www.clojure-toolbox.com/ The Clojure Toolbox] | ||
*[http://clojuredocs.org/ ClojureDocs] | *[http://clojuredocs.org/ ClojureDocs] | ||
+ | *[https://www.conj.io/ Grimoire - Community Clojure Documentation] | ||
+ | *[http://docs.huihoo.com/clojure/clojure-api-cn/ Clojure API 中文文档], [https://github.com/huangz1990/clojure_api_cn Clojure API 文档的中文计划] | ||
+ | *[https://crossclj.info/ CrossClj]: cross-referencing the Clojure ecosystem | ||
*[http://www.4clojure.com/ 4Clojure], [https://github.com/4clojure/4clojure 4clojure @ github] | *[http://www.4clojure.com/ 4Clojure], [https://github.com/4clojure/4clojure 4clojure @ github] | ||
*[http://docs.huihoo.com/clojure/a-brief-beginners-guide-to-clojure/ A Brief Beginner's Guide To Clojure] | *[http://docs.huihoo.com/clojure/a-brief-beginners-guide-to-clojure/ A Brief Beginner's Guide To Clojure] | ||
第111行: | 第311行: | ||
*[http://www.ibm.com/developerworks/cn/java/j-jn1/index.html Java 下一代: Groovy、Scala 和 Clojure] | *[http://www.ibm.com/developerworks/cn/java/j-jn1/index.html Java 下一代: Groovy、Scala 和 Clojure] | ||
*[http://www.infoq.com/cn/news/2013/04/Language-Expressiveness 研究指出:Clojure、CoffeeScript和Haskell是表现力最强的通用语言] | *[http://www.infoq.com/cn/news/2013/04/Language-Expressiveness 研究指出:Clojure、CoffeeScript和Haskell是表现力最强的通用语言] | ||
+ | *[http://www.bestinclass.dk/best-class-blogposts Best In Class] | ||
[[category:programming language]] | [[category:programming language]] | ||
[[category:functional programming]] | [[category:functional programming]] | ||
+ | [[category:lambda]] | ||
+ | [[category:numerical analysis]] | ||
+ | [[category:concurrent computing]] | ||
+ | [[category:data analysis]] | ||
[[category:JVM]] | [[category:JVM]] | ||
[[category:lisp]] | [[category:lisp]] | ||
+ | [[category:huihoo]] |
2023年4月19日 (三) 07:55的最后版本
您可以在Wikipedia上了解到此条目的英文信息 Clojure Thanks, Wikipedia. |
Clojure
目录 |
[编辑] 简介
Clojure 是一个面向JVM 动态的通用编程语言,采用 Eclipse Public License 1.0 许可证。
Lisp 是一种编程语言,以表达性和功能强大著称,但人们通常认为它不太适合应用于一般情况。Clojure 是一种运行在 Java平台上的 Lisp 方言,它的出现彻底改变了这一现状。如今,在任何具备 Java 虚拟机的地方,您都可以利用 Lisp 的强大功能。
Clojure is about Data, Scala is about Types, Java is about Objects.
[编辑] 版本
[编辑] 功能
[编辑] 编译器
- ClojureCLR 基于 Microsoft Dynamic Language Runtime (DLR) 和.NET Common Language Runtime (CLR),C# 和 Clojure 编写。
- ClojureScript
- Small Clojure Interpreter (SCI)
[编辑] 语言
由Clojure开发的编程语言:
[编辑] 指南
通过 Leiningen 安装是推荐方式
wget https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0.jar java -cp clojure-1.8.0.jar clojure.main user=> (+ 1 2 3) 6 user=> (def hello (fn [] "Hello world")) #'user/hello user=> (hello) "Hello world"
或使用 Leiningen REPL,它比 Clojure 自带的 REPL 好很多。
lein repl
Web应用启动:
lein run 或 lein ring server
[编辑] Evaluation
[编辑] Windows
C:\huihoo\clojure>powershell -noprofile -executionpolicy bypass -file .\win-install-1.10.1.469.ps1
PS C:\huihoo\clojure> clj -h
PS C:\huihoo\clojure> clj -r
Clojure 1.10.1 user=>
[编辑] Leiningen
使用leiningen工具来管理Clojure项目和Java配置。
brew install leiningen
或者获得 https://raw.github.com/technomancy/leiningen/preview/bin/lein 并放到 /bin 目录下,chmod 755
cd bin,执行 ./lein // 开始安装 Leiningen
lein help
lein help $TASK for details.
接着:
lein new start-clojure cd start-clojure lein repl 将获得一些jar,如: Retrieving org/clojure/clojure/1.4.0/clojure-1.4.0.jar ... user=> (println "Give me some Clojure!") Give me some Clojure! nil
[编辑] 插件
[编辑] fn,def,defn
defn builds on fn,defn是一个宏,它封装了def和fn的功能。
fn 创建一个匿名函数,fn 和 lambda 类似。
user=> (map (fn [x] (* x x)))
def 可以将一个匿名函数绑定到一个name上。
user=> (def my-function (fn [x] (* x x )))
defn 是 def 与 fn 的简写。
user=> (defn my-function [x] (* x x))
[编辑] Clojars
- Clojars: Clojure libraries
- Third-party templates
[编辑] 大数据
- Apache Storm
- Cascalog, 基于Apache Hadoop的数据处理。
- Onyx
- Sparkling - A Clojure API for Apache Spark
- PigPen Map-Reduce for Clojure
[编辑] 数据分析
统计、数据分析和商业智能
[编辑] 机器学习
- clj-ml
- deeplearning4j
- nurokit Toolkit for machine learning in Clojure.
- k9
[编辑] 计算机视觉
[编辑] 自然语言处理
[编辑] 消息通信
- Langohr
- Machine Head, a Clojure MQTT Client
- ZeroMQ Async
[编辑] 事件CEP
[编辑] 并行并发
- Clojure web server benchmarks
- pulsar: Actor model 实现
- core.async Go式轻量级线程,⻓得像同步的异步.
- Avout: Distributed State in Clojure
[编辑] 金融货币
- ClojureWerkz Money a Clojure Library to Work With Money
[编辑] 验证授权
- keycloak-clojure Keycloak
- Friend
- Clojure Scrypt Library
- Buddy - Security library for clojure.
[编辑] 数据库存储
- Datomic
- DataScript
- Clojure libraries for MongoDB, RabbitMQ, validations, Neo4J, ElasticSearch, Apache Cassandra, Riak, Memcached, stream processing
- hikari-cp 连接池
- clj-record 类似 Ruby on Rails ActiveRecord
- PuppetDB
[编辑] SQL
- Korma Tasty SQL for Clojure
- Honey SQL Turn Clojure data structures into SQL
- yesql https://github.com/krisajenkins/yesql
[编辑] PostgreSQL
[编辑] MongoDB
Clojure Monger, Monger @ GitHub
[编辑] Cassandra
- cassaforte 建议:暂不使用高版本Cassandar,因为可能不支持。
- alia: High performance Cassandra client for clojure
- hayt: CQL3 DSL for Clojure
[编辑] Redis
[编辑] HBase
[编辑] BI
[编辑] Elasticsearch
[编辑] Web HTTP
- ring
- Compojure
- clj-http
- http-kit
- aleph built on top of Netty
- Cheshire
- necessary-evil XML-RPC
- nginx-clojure
- Pedestal
- Hiccup
[编辑] RESTful API
- compojure-api with Compojure & Swagger
- liberator
- ring-swagger, Swagger Spec for Clojure Web Apps
- Sweet-Liberty
[编辑] IDE和Editor
- logseq 写作平台
- CIDER extends GNU Emacs is the Clojure(Script) Interactive Development Environment that Rocks!
- Light Table
- Nightcode
- Cursive IDE
- CCW IDE
- Nightcode
- clooj, a lightweight IDE for clojure
- Catnip, A web based Clojure IDE
- clojure-emacs for Emacs
- Clojure with Emacs
- SublimeREPL for SublimeText
- fireplace.vim: Clojure REPL support
[编辑] GUI
[编辑] 项目
- Clojure @ GitHub
- ClojureWerkz团队开发了众多开源项目
- Status A Mobile Ethereum Client.
- Apache Storm
- tryclojure
- ClojureScript
- test.check QuickCheck for Clojure
- incanter
- Ring
- Compojure
- CravenDB文档数据库
- CircleCI's frontend
- Enlive
- Conjure A Rails like framework for Clojure.
- Boot: Build tooling for Clojure
- cljsjs
- alda 音乐编程语言
- 用 overtone 来演奏歌曲
- schema 数据描述与验证
- Timbre 日志库
- cronj cron for clojure
- clj-bloom
- Cognitect Cognitect Labs
[编辑] 文档
[编辑] 图书
[编辑] 用户
- Cognitect, Clojue之父,Rich Hickey 是该公司Co-Founder & CTO。
- 花旗信用实时风险估值系统Java/Clojure后端(1500节点分布计算)花旗投资信用部实时风险计算系统,逻辑使用Clojure。
- Puppet: Puppet Server, Trapperkeeper, PuppetDB, Trapperkeeper Webserver Service
- 沃尔玛: “Our Clojure system just handled its first Walmart black Friday and came out without a scratch.” - Walmart Labs
- Riemann
- LeanCloud 采用了多种语言混合来构建整个后端系统,包括 Clojure、Java、Node.js、Scala 等。其中 Clojure 构建了整个网站门户、存储开放 API、推送、聊天等核心服务,Node.js构建了云端代码服务(类似应用代码托管),我们还使用 Scala 编写的 Spark 任务来处理离线数据分析,此外,还有大量的统计类 MapReduce 任务使用 Java 编写并运行在 Hadoop 集群上。不同服务之间使用 RESTful 协议、RPC 框架或者队列进行通信。
[编辑] 图集
[编辑] 链接
- Clojure官网
- Clojure Handbook
- Clojure Blog
- Planet Clojure
- Clojars
- The Clojure Toolbox
- ClojureDocs
- Grimoire - Community Clojure Documentation
- Clojure API 中文文档, Clojure API 文档的中文计划
- CrossClj: cross-referencing the Clojure ecosystem
- 4Clojure, 4clojure @ github
- A Brief Beginner's Guide To Clojure
- Data Sorcery with Clojure
- http://groups.google.com/group/clojure
- Clojure 语言的设计
- Clojure 编程语言
- FlightCaster秘笈——Clojure和Rails
- ClojureScript通过Javascript将Clojure引入到浏览器端
- Java 下一代: Groovy、Scala 和 Clojure
- 研究指出:Clojure、CoffeeScript和Haskell是表现力最强的通用语言
- Best In Class