1. Trang chủ
  2. » Công Nghệ Thông Tin

Programming Clojure pot

297 1,5K 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 297
Dung lượng 1,61 MB

Nội dung

[...]... http://code.google.com/p /clojure- contrib 31 C LOJURE C ODING Q UICK S TAR T Building Clojure Yourself Because the sample code for the book includes clojure. jar, you do not need to download anything else to get started However, you may want to build Clojure or clojure- contrib from source to get access to newer features and bug fixes Here’s how: For Clojure: svn co http:/ /clojure. googlecode.com/svn/trunk/ clojure cd clojure. .. ant For clojure- contrib: svn co http:/ /clojure- contrib.googlecode.com/svn/trunk/ clojure- contrib cd clojure- contrib ant The sample code is regularly updated to match the current development head of Clojure and clojure- contrib Check the README file in the sample code to see the revision numbers that the samples were most recently tested with Warning: The SourceForge projects for Clojure and clojurecontrib... available under the clojure tag at the Relevance blog.7 4 5 6 7 http://www.pragprog.com/titles/shcloj /programming- clojure http://www.pragprog.com/titles/shcloj/errata http://forums.pragprog.com/forums/91 http://blog.thinkrelevance.com/tags /clojure 19 D OWNLOADING S AMPLE C ODE Downloading Sample Code The sample code for the book is available from one of two locations: • The Programming Clojure home page8... proceeding slowly Like any other Lisp, Clojure faces two challenges: • Clojure must succeed as a Lisp by persuading Lisp programmers that Clojure embraces the critical parts of Lisp • At the same time, Clojure needs to succeed where past Lisps have failed by winning support from the broader community of programmers Clojure meets these challenges by providing the metaprogramming capabilities of Lisp and... ? Clojure avoids the extra parentheses: ; Clojure cond (cond (< x 10) "less" (> x 10) "more" ) This is an aesthetic decision, and both approaches have their supporters The important thing is that Clojure takes the opportunity to be less Lispy when it can do so without compromising Lisp’s power Clojure is an excellent Lisp, both for Lisp experts and Lisp beginners Clojure Is a Functional Language Clojure. .. style when you need it Java invocation is covered in Chapter 3, Working with Java, on page 79 Clojure s approach to changing state enables concurrency without explicit locking and complements Clojure s functional core 28 W HY C LOJURE ? Clojure Simplifies Concurrent Programming Clojure s support for functional programming makes it easy to write thread-safe code Since immutable data structures cannot ever... concurrent programs, you will enjoy Clojure Clojure combines ideas from Lisp, functional programming, and concurrent programming and makes them more approachable to programmers seeing these ideas for the first time Clojure is part of a larger phenomenon Languages such as Erlang, F#, Haskell, and Scala have garnered attention recently for their support of functional programming and/or their concurrency... common ground with Clojure What Is in This Book Chapter 1, Getting Started, on page 21, demonstrates Clojure s elegance as a general-purpose language, plus the functional style and concurrency model that make Clojure unique It also walks you through installing Clojure and developing code interactively at the REPL Chapter 2, Exploring Clojure, on page 45, is a breadth-first overview of all of Clojure s core... concurrency model around locking, which is difficult to use correctly Clojure provides several alternatives to locking: software transactional memory, agents, atoms, and dynamic variables • Clojure embraces Java Calling from Clojure to Java is direct and fast, with no translation layer • Unlike many popular dynamic languages, Clojure is fast Clojure is written to take advantage of the optimizations possible... make Clojure unique 8 9 http://www.pragprog.com/titles/shcloj http://github.com/stuarthalloway /programming- clojure 20 Chapter 1 Getting Started We will begin this chapter by briefly exploring the features that make Clojure compelling: • Elegant, expressive code • Lisp’s powerful notion that code is data • Easy, fast Java interoperability • A sequence library that unifies all kinds of data • Functional programming . rise. Preface Clojure is a dynamic programming language for the Java Virtual Ma- chine (JVM), with a compelling combination of features: • Clojure is elegant. Clojure s. several clojure- contrib libraries, including the test-is testing framework Stu is passionate about finding better ways to develop software, and Programming Clojure

Ngày đăng: 15/03/2014, 10:20

w