Tabela de Conteúdos
:: Topo :: doCoding :: Linguagens de Programação
Clojure
- Clojure - Clojure is a dynamic programming language that targets the Java Virtual Machine. It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language - it compiles directly to JVM bytecode, yet remains completely dynamic. Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs.
- Rationale - Clojure meets its goals by: embracing an industry-standard, open platform - the JVM; modernizing a venerable language - Lisp; fostering functional programming with immutable persistent data structures; and providing built-in concurrency support via software transactional memory and asynchronous agents. The result is robust, practical, and fast.
- Functional Programming - Clojure is a functional programming language. It provides the tools to avoid mutable state, provides functions as first-class objects, and emphasizes recursive iteration instead of side-effect based looping. Clojure is impure, in that it doesn't force your program to be referentially transparent, and doesn't strive for 'provable' programs. The philosophy behind Clojure is that most parts of most programs should be functional, and that programs that are more functional are more robust.
- Values and Change - Clojure's approach to Identity and State - Many people come to Clojure from an imperative language and find themselves out of their element when faced with Clojure's approach to doing things, while others are coming from a more functional background and assume that once they leave Clojure's functional subset, they will be faced with the same story re: state as is found in Java. This essay intends to illuminate Clojure's approach to the problems faced by imperative and functional programs in modeling the world.
- Concurrent Programming - Clojure simplifies multi-threaded programming in several ways. The software transactional memory system (STM) supports sharing changing state between threads in a synchronous and coordinated manner. Clojure does not replace the Java thread system, rather it works with it. Clojure functions are java.util.concurrent.Callable, therefore they work with the Executor framework etc.
- Getting Started - Clojure is delivered in a zip file containing a single .jar, clojure.jar, a readme, the EPL license and the source code in a src subdirectory. It uses the ASM 3.0 bytecode library, and the current alpha distribution includes it. Java 1.5 or greater is required.
- Clojure - Clojure is a dynamic programming language designed to be general-purpose, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure compiles directly to JVM bytecode. Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language,and features a rich set of immutable, persistent data structures.
- ClojureX - An easy way to set up a full Clojure development environment.
- Clojure Box - Clojure Box is an all-in-one installer for Clojure on Windows.
- Clojars is a dead easy community repository for open source Clojure libraries.
Training Courses
Books
- Clojure Programming - From Wikibooks, the open-content textbooks collection
Resources
- clojure-euler wiki - Project Euler problems solved with Clojure
- PCL -> Clojure - My current leisure-time project is porting the examples from Peter Seibel's excellent Practical Common Lisp (PCL) to Clojure.
- On Lisp -> Clojure - I am porting the examples from the macro chapters of Paul Graham's On Lisp (OL) to Clojure.
- The Clojure programming language - Take advantage of the Clojure plug-in for Eclipse.
Blogs & Wikis
- Clojure - News about the Clojure programming language
- The need for Clojure - This series is about Beginning Clojure in Practice.
- Some notes about Clojure - I fooled around with Clojure a little and wanted to share some of the things which haven’t gotten much play so far.
Articles
-
- Clojure: Challenge your Java assumptions - Clojure is a dynamic functional language for the JVM, recently released in version 1.0. Clojure offers a new set of programming techniques for robust code and rapid development. In particular, it has new solutions for multicore computing. Whether you make the shift to Clojure or stick to Java, learning about this new language will challenge your assumptions about the best way to design software.
- Clojure Brings STM, LISP to the JVM - Clojure is rather new member of the LISP family of languages which runs on the Java platform. Introduced in 2007 it has already garnered a lot of interest. One reason is Clojure's approach to concurrency which is built upon the concepts of Software Transactional Memory (STM).
- Live Production Clojure Application Announced - It was announced recently on the Clojure Google Group that a hospital services system has been developed, in part using Clojure, and has been put into live production use in a major veterinary hospital. The product appears to use several languages and technologies, but Clojure appears to play an important role. This announcement carries some signficance, as it is one of the first published reports of Clojure being used in a large-scale production deployment, particularly one as sensitive as a hospital environment. As a language, Clojure is relatively young, having only been under development for a few years.
Scala
- Is Scala Not “Functional Enough”? - In one of Rich Hickey’s excellent presentations introducing Clojure, he mentions in passing that Scala “isn’t really a functional language”. He says that Java and Scala are both cut from the same mold, and because Scala doesn’t force immutability it really shouldn’t qualify. These viewpoint is something I’ve been hearing a lot of from various sources, people talking about how F# is really the only mainstream functional language, or how once Erlang takes off it will leave Scala in the dust.
- Scala vs. Clojure - I think the object oriented features of Scala make the language more usable for real world applications. But the idea of Clojure - tight integration with Java through Iterable and Iterator, implementing Java interfaces, but keeping immutable structures, compared to Scala which creates it’s own incompatible versions, should prove much more successful.
- LOTY Time Again: Scala or Clojure?!?! - So, at this point I want to delve into a language that attempts to tackle the concurrent/multicore programming challenge. I’d like to stay on the JVM because I appreciate the benefits that it brings as a platform, so for now Erlang is out. The two leading candidates in the JVM/concurrent/multicore arena seem to be Scala and Clojure. An added benefit of both of these languages is that they support the functional paradigm, something I haven’t really played with since my computer science education days and a very interesting language named Haskell. Scala is a multiparadigm language, supporting both object-oriented and functional constructs. It is statically typed, yet offers very nice type inference. Clojure, on the other hand, is a functional Lisp derivative with almost no OO constructs that is dynamically typed. Both are designed to enable concurrent programming. Which one do I choose? I open the floor for comments.
- Is Scala or Clojure poised for stardom? - Is Scala, which was designed only a short while ago (comparatively speaking, that is) poised for stardom? Or will Clojure achieve greatness instead? There are a number of complementary aspects that seem to indicate for the time being that Scala might; however, what remains to be seen is if Scala can stand above recent newcomer Clojure. Both languages often show up together, especially when the topic of conversation is concurrency; nevertheless, each language is distinctly different. What’s interesting is how each language is starting to show up in various hip places.
- Is Scala or Clojure poised for stardom? - Is Scala or Clojure poised for stardom? Can two languages co-exist as stars or does one invariably outshine the other? If history is any indication, then I’d venture to guess that the answer is that both can’t be stars– just like both Groovy and JRuby aren’t stars. They co-exist and, in truth, divide the market and have followers with strong opinions on both sides. Thus, if I had to guess right now, I’d say that Scala has the edge with some good momentum. Yet, as pointed out earlier, if concurrency is the concern that’ll give each language the killer application-like fame, then they’ve got more time to mature and thus educate the market on how they may address concurrency concerns more appropriately than that of Java. What remains to be seen is if they can compellingly convince the Java market to learn their way of programming rather than leveraging what’s home (i.e. the Java language) for the majority of their respective target audiences.
Concurrency
Presentations
- Clojure for Lisp Programmers Part 1 - Part 1 of a presentation by Rich Hickey at the Boston Lisp meeting. A fairly extensive introduction to Clojure, with a presumption of prior knowledge of Lisp.
- Clojure for Lisp Programmers Part 2 - Part 2 of a presentation by Rich Hickey at the Boston Lisp meeting. A fairly extensive introduction to Clojure, with a presumption of prior knowledge of Lisp.
- Clojure for Java Programmers - 1 of 2 - Part 1 of a presentation by Rich Hickey to the NYC Java Study Group. A gentle introduction to Clojure, part 1 focuses on reader syntax, core data structures, code-as-data, evaluation, special operators, functions, macros and sequences. No prior exposure to Lisp is presumed.
- Clojure for Java Programmers - 2 of 2 - Part 2 of a presentation by Rich Hickey to the NYC Java Study Group. A gentle introduction to Clojure, part 2 focuses on Java integration, functional programming, persistent data structures and concurrency.
- Clojure Data Structures - Part 1 - Part 1 of an informal introductory talk/screencast covering Clojure's data structures by Rich Hickey, the author of Clojure. Covers numbers, symbols, keywords, lists, vectors and maps.
- Clojure Data Structures - Part 2 - Part 2 of an informal introductory talk/screencast covering Clojure's data structures by Rich Hickey, the author of Clojure. Covers numbers, symbols, keywords, lists, vectors and maps.
- Clojure Sequences - An informal introductory talk/screencast covering Clojure's sequences by Rich Hickey, the author of Clojure. Covers the motivation behind sequences, their relationship to cons, iterators/enumerators and collections, the sequence library, and laziness.
- java-4-2009 - This talk aims to introduce the two-way street of scripting on the Java platform. First, we'll look at how to interact with your scripts from Java in a language-agnostic way, using the javax.script package found in Java 6. Then, we'll spin around and talk to Java from a few of the more popular JVM scripting languages: JavaScript (Rhino), Groovy, JRuby, and Jython. From there you'll have everything you need to start combining the power and flexibility of scripting with the reliability, scalability, and robust tooling of the Java platform.
Tutorials
- labrepl for Clojure - Labrepl is an environment for exploring the Clojure language.
TDD/BDD
- Fact - Unit testing library for Clojure ( no longer active).
- unit_test - A unit-testing framework for Clojure.
- test-expect - function mocking library for unit testing in clojure.
- rtfspec - A spec framework for Clojure.
- conducta - Behavior-driven development in Clojure.
- circumspec - Circumspec: BDD in Clojure.
Web Frameworks
Libraries and Toolkits
- clojure-contrib - Extensions and enhancements to the Clojure libraries. Contributions are made here only under the Clojure Contributor Agreement, and may become part of the main Clojure distribution.
- clojure-gem - Use Clojure's immutable data structures and Software Transactional Memory from Ruby. Don't be afraid of concurrency.
- clojure-json - A JSON encoder/parser for clojure.
IDEs
- Enclojure - Enclojure is an integrated development environment for the Clojure programming language. In addition to providing an IDE for the Clojure language, our goal is to build on the inspirational work of Rich Hickey (inventor of Clojure) in building a development environment better suited to support developers preparing applications for the massively multi-core platforms of the near future. Enclojure is a plugin for the NetBeans IDE and works with NetBeans 6.5.
- clojure-dev - clojure-dev is an integrated development environment (IDE) for the Clojure programming language, built on the Eclipse platform.
- counterclockwise - Counterclockwise is an Eclipse plugin helping developers write Clojure code.
- Waterfront - A toolkit for the Clojure programming language. Including a general purpose that augments Clojure's standard library, a platform the plugin-extensible GUI applications, a simple Clojure IDE based on that platform, testing services and more.
- Ideone.com - Online IDE & Debugging Tool that allows “pasties” in Clojure.
DataBases
- clojureql - Providing an SQL wrapper for Clojure with queries as higher order functions
- clj-record - A pseudo-port of ActiveRecord to the Clojure programming language.
- clj-crud - SQL Database CRUD operations for Clojure.