开发者

Good Clojure Code Examples? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 4 years ago.

Improve this question

I'm in the process of checking out Clojure for the first time. I've found it useful looking at the (doc xxx) and (source xxx) of the Clojure core library, but I'm 开发者_开发问答more concerned with how you would organise and put together a full application.

Are there any excellent, open source examples of this?

For example, to learn how to code well in Java I might look at the Spring source-code, or something similar.


Prominent open source Clojure projects:

  • Compojure - a web framework (since you mentioned Spring)
  • Ring - HTTP abstraction API
  • Incanter - R-like statistical computing and graphics environment
  • Leiningen - a build tool for Clojure
  • Clojure-Contrib - you mentioned the core library, but contrib is definitely worth looking at as well.
  • Enclojure - Clojure IDE tools (used with Netbeans/Redcar)
  • Counterclockwise - Eclipse plugin for Clojure
  • 4Clojure - Website with interactive fill-in-the-blank Clojure problems

A few blog posts explaining bite-sized Clojure applications:

  • Pong in Clojure
  • Buddhabrot in Clojure


http://corfield.org/blog/archives.cfm/category/clojure

This guy is doing a blog which among other things, has an article series on "real world clojure examples". I think this is one of the best places for this sort of thing, because the articles don't simply provide source files for you to read, he often taken on specific practical problems, describes them first, the rationale behind choosing clojure, and rationale behind choosing a specific way of doing things in each article. (And then some code excerpts as well.) This gives much more eclectic view on the examples themselves, and better understanding of not only What and How, but Why.

(You may want to scroll down a bit in the archives, he has a lot of clojure articles which are good themselves, but this post is especially true about the mentioned "real world clojure" series, which begin with articles like http://corfield.org/blog/post.cfm/real-world-clojure-email-status-tracking)


I find that looking at the project.clj for most of these projects is a good first step in getting a good idea of the core libraries these projects are relying on. Mostly if one of the more popular and heavily used open source libraries, like Compojure for example, are using certain base libraries, like Ring in the case of Compojure, I can then focus on how those base libraries are being leveraged. This is how I got a good idea of how Ring middleware works and that helped me understand Noir worked and allowed me to also understand how one could substitute something like Grizzly for Jetty or how to implement something like OAuth 2 using just middleware.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜