Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: sattvik/clojure
...
head fork: sattvik/clojure
  • 10 commits
  • 5 files changed
  • 0 commit comments
  • 5 contributors
View
598 changes.md
@@ -1,470 +1,310 @@
<!-- -*- mode: markdown ; mode: visual-line ; coding: utf-8 -*- -->
-# Changes to Clojure in Version 1.3
+# Changes to Clojure in Version 1.4
## CONTENTS
+
<pre>
1 Deprecated and Removed Features
- 1.1 Earmuffed Vars are No Longer Automatically Considered Dynamic
- 1.2 ISeq No Longer Inherits from Sequential
- 1.3 Removed Bit Operation Support for Boxed Numbers
- 1.4 Ancillary Namespaces No Longer Auto-Load on Startup
- 1.5 Replicate Deprecated
+ 1.1 Fields that Start With a Dash Can No Longer Be Accessed Using Dot Syntax
2 New/Improved Features
- 2.1 Enhanced Primitive Support
- 2.2 defrecord and deftype Improvements
- 2.3 Better Exception Reporting
- 2.4 clojure.reflect/reflect
- 2.5 clojure.data/diff
- 2.6 clojure.core/every-pred and clojure.core/some-fn Combinators
- 2.7 clojure.core/realized?
- 2.8 clojure.core/with-redefs-fn & with-redefs
- 2.9 clojure.core/find-keyword
- 2.10 clojure.repl/pst
- 2.11 clojure.pprint/print-table
- 2.12 pprint respects *print-length*
- 2.13 compilation and deployment via Maven
- 2.14 internal keyword map uses weak refs
- 2.15 ^:const defs
- 2.16 Message Bearing Assert
- 2.17 Error Checking for defmulti Options
- 2.18 Removed Checked Exceptions
- 2.19 vector-of Takes Multiple Arguments
- 2.20 deref with timeout
- 2.21 Walk Support for sorted-by Collections
- 2.22 string.join Enhanced to Work with Sets
- 2.23 clojure.test-helper
- 2.24 Newline outputs platform-specific newline sequence
- 2.25 init-proxy and update-proxy return proxy
- 2.26 doc & find-doc moved to REPL
- 2.27 clojure.java.shell/sh accepts as input anything that clojure.java.io/copy does
- 2.28 InterruptedHandler Promoted to clojure.repl
- 2.29 Add support for running -main namespaces from clojure.main
- 2.30 Set thread names on agent thread pools
- 2.31 Add docstring support to def
- 2.32 Comp function returns identity when called with zero arity
- 2.33 Type hints can be applied to arg vectors
- 2.34 Binding Conveyance
+ 2.1 Reader Literals
+ 2.2 clojure.core/mapv
+ 2.3 clojure.core/filterv
+ 2.4 clojure.core/ex-info and clojure.core/ex-data
+ 2.5 clojure.core/reduce-kv
+ 2.6 clojure.core/contains? Improved
+ 2.7 clojure.core/min and clojure.core/max prefer NaN
+ 2.8 clojure.java.io/as-file and clojure.java.io/as-url Handle URL-Escaping Better
+ 2.9 New Dot Syntax for Record and Type Field Access
+ 2.10 Record Factory Methods Available Inside defrecord
+ 2.11 assert-args Displays Namespace and Line Number on Errors
+ 2.12 File and Line Number Added to Earmuff Dynamic Warning
+ 2.13 require Can Take a :refer Option
+ 2.14 *compiler-options* Var
+ 2.15 Improved Reporting of Invalid Characters in Unicode String Literals
+ 2.16 clojure.core/hash No Longer Relies on .hashCode
+ 2.17 Java 7 Documentation
+ 2.18 loadLibrary Loads Library Using System ClassLoader
+ 2.19 Java int is boxed as java.lang.Integer
3 Performance Enhancements
4 Bug Fixes
- 5 Modular Contrib
</pre>
## 1 Deprecated and Removed Features
-### 1.1 Earmuffed Vars Are No Longer Automatically Considered Dynamic.
-
- (def *fred*)
- => Warning: *fred* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic ** or change the name.
-
-### 1.2 ISeq No Longer Inherits From Sequential
-
-This allows ISeq implementers to be in the map or set equality partition.
-
-### 1.3 Removed Bit Operation Support for Boxed Numbers
-
-Bit Operations map directly to primitive operations
-
-### 1.4 Ancillary Namespaces No Longer Auto-Load on Startup
-
-The following namespaces are no longer loaded on startup: clojure.set, clojure.xml, clojure.zip
-
-### 1.5 Replicate Deprecated
-
-Use repeat instead.
-
-## 2 New/Improved Features
-
-### 2.1 Enhanced Primitive Support
-
-Full details here:
-
- - [Enhanced Primitive Support][EPS]
- - [Documentation for 1.3 Numerics][NUM]
-
-[EPS]: http://dev.clojure.org/display/doc/Enhanced+Primitive+Support
-[NUM]: http://dev.clojure.org/display/doc/Documentation+for+1.3+Numerics
-
-### 2.2 defrecord and deftype Improvements
-
-Details here: [Defrecord Improvements](http://dev.clojure.org/display/design/defrecord+improvements)
-
-### 2.3 Better Exception Reporting
-
-Details here: [Error Handling](http://dev.clojure.org/display/design/Error+Handling)
-
-Additionally:
-
-Better error messages:
-
- * When calling macros with arity
- * For Invalid Map Literals
- * For alias function if using unknown namespace
- * In the REPL
- * Add "starting at <line>" to EOF while reading exceptions
- * Better compilation error reporting
-
-### 2.4 clojure.reflect/reflect
-
-Full details here: [Reflection API](http://dev.clojure.org/display/design/Reflection+API)
-
-### 2.5 clojure.data/diff
-
-Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]
-
- (diff {:a 1 :b 2} {:a 1 :b 22 :c 3})
- => ({:b 2} {:c 3, :b 22} {:a 1})
-
-### 2.6 clojure.core/every-pred and clojure.core/some-fn Combinators
-
-every-pred takes a set of predicates and returns a function f that returns true if all of its composing predicates return a logical true value against all of its arguments, else it returns false.
-
- ((every-pred even?) 2 4 6)
- => true
-
- ((every-pred even?) 2 4 5)
- =>false
-
-some-fn takes a set of predicates and returns a function f that returns the first logical true value returned by one of its composing predicates against any of its arguments, else it returns logical false.
-
- ((some-fn even?) 2 4 5)
- => true
- ((some-fn odd?) 2 4 6)
- => false
-
-### 2.7 clojure.core/realized?
-
-Returns true if a value has been produced for a promise, delay, future or lazy sequence.
+### 1.1 Record and Type Fields that Start With a Dash Can No Longer Be Accessed Using Dot Syntax
- (let [x (range 5)]
- (println (realized? x))
- (first x)
- (println (realized? x)))
- => false
- => true
+Clojure 1.4 introduces a field accessor syntax for the dot special form that aligns Clojure field lookup syntax with ClojureScript's.
-### 2.8 clojure.core/with-redefs-fn & clojure.core/with-redefs
+For example, in Clojure 1.3, one can declare a record with a field starting with dash and access it like this:
-with-redefs-fn temporarily redefines Vars during a call to func. with-redefs temporarily redefines Vars while executing the body.
+ (defrecord Bar [-a]) ;=> user.Bar
+ (.-a (Bar. 10)) ;=> 10
+
+In 1.4, the above code results in `IllegalArgumentException No matching field found: a for class user.Bar`
- (with-redefs [nil? :temp] (println nil?))
- => :temp
+However, the field may still be accessed as a keyword:
-### 2.9 clojure.core/find-keyword
+ (:-a (Bar. 10)) ;=> 10
-Returns a Keyword with the given namespace and name if one already exists.
+## 2 New and Improved Features
- (find-keyword "def")
- => :def
- (find-keyword "fred")
- => nil
+### 2.1 Reader Literals
-### 2.10 clojure.repl/pst
+Clojure 1.4 supports reader literals, which are data structures tagged
+by a symbol to denote how they will be read.
-Prints a stack trace of the exception
+When Clojure starts, it searches for files named `data_readers.clj`
+at the root of the classpath. Each such file must contain a Clojure
+map of symbols, like this:
+ {foo/bar my.project.foo/bar
+ foo/baz my.project/baz}
- (pst (IllegalArgumentException.))
+The key in each pair is a tag that will be recognized by
+the Clojure reader. The value in the pair is the
+fully-qualified name of a Var which will be invoked by the reader to
+parse the form following the tag. For example, given the
+data_readers.clj file above, the Clojure reader would parse this
+form:
- IllegalArgumentException
- user/eval27 (NO_SOURCE_FILE:18)
- clojure.lang.Compiler.eval (Compiler.java:6355)
- clojure.lang.Compiler.eval (Compiler.java:6322)
- clojure.core/eval (core.clj:2699)
- clojure.main/repl/read-eval-print--5906 (main.clj:244)
- clojure.main/repl/fn--5911 (main.clj:265)
- clojure.main/repl (main.clj:265)
- clojure.main/repl-opt (main.clj:331)
- clojure.main/main (main.clj:427)
- clojure.lang.Var.invoke (Var.java:397)
- clojure.lang.Var.applyTo (Var.java:518)
- clojure.main.main (main.java:37)
+ #foo/bar [1 2 3]
-### 2.11 clojure.pprint/print-table
+by invoking the Var `#'my.project.foo/bar` on the vector `[1 2 3]`. The
+data reader function is invoked on the form AFTER it has been read
+as a normal Clojure data structure by the reader.
-Prints a collection of maps in a textual table.
+Reader tags without namespace qualifiers are reserved for Clojure. Default
+reader tags are defined in `clojure.core/default-data-readers` but may be
+overridden in `data_readers.clj` or by rebinding `*data-readers*`.
- (print-table [:fred :barney]
- [{:fred "ethel"}
- {:fred "wilma" :barney "betty"}])
+#### 2.1.1 Instant Literals
- ===============
- :fred | :barney
- ===============
- ethel |
- wilma | betty
- ===============
+Clojure supports literals for instants in the form
+`#inst "yyyy-mm-ddThh:mm:ss.fff+hh:mm"`. These literals are parsed as `java.util.Date`s
+by default. They can be parsed as `java.util.Calendar`s or `java.util.Timestamp`s
+by binding `*data-readers*` to use `clojure.instant/read-instant-calendar` or
+`clojure.instant/read-instant-timestamp`.
-### 2.12 pprint respects \*print-length\*
+ (def instant "#inst \"@2010-11-12T13:14:15.666\"")
+
+ ; Instants are read as java.util.Date by default
+ (= java.util.Date (class (read-string instant)))
+ ;=> true
+
+ ; Instants can be read as java.util.Calendar or java.util.Timestamp
+
+ (binding [*data-readers* {'inst read-instant-calendar}]
+ (= java.util.Calendar (class (read-string instant))))
+ ;=> true
-Assigning \*print-length\* now affects output of pprint
+ (binding [*data-readers* {'inst read-instant-timestamp}]
+ (= java.util.Timestamp (class (read-string instant))))
+ ;=> true
-### 2.13 compilation and deployment via Maven
+#### 2.1.2 UUID Literals
-See the following pages for more information:
+Clojure supports literals for UUIDs in the form `#uuid "uuid-string"`. These
+literals are parsed as `java.util.UUID`s.
- - [Maven Settings and Repositories][MSR]
- - [Why Maven?][WM]
- - [Common Contrib Build][CCB]
- - [How to Make Releases][HMR]
-
- [MSR]: http://dev.clojure.org/display/doc/Maven+Settings+and+Repositories
- [WM]: http://dev.clojure.org/pages/viewpage.action?pageId=950842
- [CCB]: http://dev.clojure.org/display/design/Common+Contrib+Build
- [HMR]:http://dev.clojure.org/display/design/How+to+Make+Releases
+### 2.2 clojure.core/mapv
-### 2.14 internal keyword map uses weak refs
+`mapv` takes a function `f` and one or more collections and returns a
+vector consisting of the result of applying `f` to the set of first items of
+each collection, followed by applying `f` to the set of second items in each
+collection, until any one of the collections is exhausted. Any remaining
+items in other collections are ignored. `f` should accept a number of arguments
+equal to the number of collections.
-### 2.15 ^:const defs
+ (= [1 2 3] (mapv + [1 2 3]))
+ ;=> true
-^:const lets you name primitive values with speedier reference.
+ (= [2 3 4] (mapv + [1 2 3] (repeat 1)))
+ ;=> true
- (def constants
- {:pi 3.14
- :e 2.71})
+### 2.3 clojure.core/filterv
- (def ^:const pi (:pi constants))
- (def ^:const e (:e constants))
+`filterv` takes a predicate `pred` and a collection and returns a vector
+of the items in the collection for which `(pred item)` returns true. `pred`
+must be free of side-effects.
-The overhead of looking up :e and :pi in the map happens at compile time, as (:pi constants) and (:e constants) are evaluated when their parent def forms are evaluated.
+ (= [] (filterv even? [1 3 5]))
+ ;=> true
-### 2.16 Message Bearing Assert
+ (= [2 4] (filter even? [1 2 3 4 5]))
+ ;=> true
-Assert can take a second argument which will be printed when the assert fails
+### 2.4 clojure.core/ex-info and clojure.core/ex-data
- (assert (= 1 2) "1 is not equal to 2")
- => AssertionError Assert failed: 1 is not equal to 2
+`ex-info` creates an instance of `ExceptionInfo`. `ExceptionInfo` is a
+`RuntimeException` subclass that takes a string `msg` and a map of data.
-### 2.17 Error Checking for defmulti Options
+ (ex-info "Invalid use of robots" {:robots false})
+ ;=> #<ExceptionInfo clojure.lang.ExceptionInfo: Invalid use of robots {:robots false}>
-defmulti will check to verify that its options are valid. For example, the following code will throw an exception:
+`ex-data` is called with an exception and will retrieve that map of data
+if the exception is an instance of `ExceptionInfo`.
- (defmulti fred :ethel :lucy :ricky)
- => IllegalArgumentException
+ (ex-data (ex-info "Invalid use of robots" {:robots false}))
+ ;=> {:robots false}
-### 2.18 Removed Checked Exceptions
+### 2.5 clojure.core/reduce-kv
-Clojure does not throw checked exceptions
+`reduce-kv` reduces an associative collection. It takes a function `f`,
+an initial value `init` and an associative collection `coll`. `f` should
+be a function of 3 arguments. Returns the result of applying `f` to `init`,
+the first key and the first value in `coll`, then applying `f` to that result
+and the 2nd key and value, etc. If `coll` contains no entries, returns `init`
+and f is not called. Note that `reduce-kv` is supported on vectors,
+where the keys will be the ordinals.
-### 2.19 vector-of Takes Multiple Args
+ (reduce-kv str "Hello " {:w \o :r \l :d \!})
+ ;=> "Hello :rl:d!:wo"
+ (reduce-kv str "Hello " [\w \o \r \l \d \!])
+ ;=> "Hello 0w1o2r3l4d5!"
-vector-of takes multiple args used to populate the array
+### 2.6 clojure.core/contains? Improved
- (vector-of :int 1 2 3)
- => [1 2 3]
+`contains?` now works with `java.util.Set`.
-### 2.20 deref with timeout
+### 2.7 clojure.core/min and clojure.core/max prefer NaN
-deref now takes a timeout option - when given with a blocking reference, will return the timeout-val if the timeout (in milliseconds) is reached before value is available.
+`min` and `max` now give preference to returning NaN if either of their
+arguments is NaN.
- (deref (promise) 10 :ethel)
- => :ethel
+### 2.8 clojure.java.io/as-file and clojure.java.io/as-url Handle URL-Escaping Better
-### 2.21 Walk Support for sorted-by Collections
+`as-file` and `as-url` now handle URL-escaping in both directions.
-Walk modified to work on sorted-by collections
+### 2.9 New Dot Syntax for Record and Type Field Access
- let [x (sorted-set-by > 1 2 3)] (walk inc reverse x))
- => (2 3 4)
+Clojure 1.4 introduces a field accessor syntax for the dot special
+form that aligns Clojure field lookup syntax with ClojureScript's.
-### 2.22 string.join Enhanced to Work with Sets
+In 1.4, to declare a record type and access its property `x`, one can
+write:
-Just like join works on other collections
+ (defrecord Foo [x]) ;=> user.Foo
+ (.-x (Foo. 10)) ;=> 10
+
+This addition makes it easier to write code that will run as expected
+in both Clojure and ClojureScript.
- (join " and " #{:fred :ethel :lucy})
- => ":lucy and :fred and :ethel"
+### 2.10 Record Factory Methods Available Inside defrecord
-### 2.23 clojure.test-helper
+Prior to 1.4, you could not use the factory functions (`->RecordClass`
+and `map->RecordClass`) to construct a new record from inside a
+`defrecord` definition.
-All test helpers moved into clojure.test-helper
+The following example did not work prior to 1.4, but is now
+valid. This example makes use of `->Mean` which would have not yet
+been available.
-### 2.24 Newline outputs platform-specific newline sequence
+ (defrecord Mean [last-winner]
+ Player
+ (choose [_] (if last-winner last-winner (random-choice)))
+ (update-strategy [_ me you] (->Mean (when (iwon? me you) me))))
-Newline sequence is output as \r\n on Windows now.
+### 2.11 assert-args Displays Namespace and Line Number on Errors
-### 2.25 init-proxy and update-proxy return proxy
+`assert-args` now uses &form to report the namespace and line number where
+macro syntax errors occur.
-Now you can chain calls on the proxy
+### 2.12 File and Line Number Added to Earmuff Dynamic Warning
-### 2.26 doc & find-doc moved to REPL
+When a variable is defined using earmuffs but is not declared dynamic,
+Clojure emits a warning. That warning now includes the file and line
+number.
-Adds special form docs to the REPL
+### 2.13 require Can Take a :refer Option
-### 2.27 clojure.java.shell/sh accepts as input anything that clojure.java.io/copy does
+`require` can now take a `:refer` option. `:refer` takes a list of symbols
+to refer from the namespace or `:all` to bring in all public vars.
-This adds InputStream, Reader, File, byte[] to the list of inputs for clojure.java.shell/sh
+### 2.14 \*compiler-options\* Var
-### 2.28 Interrupt Handler Promoted to clojure.repl
+The dynamic var `*compiler-options*` contains a map of options to send
+to the Clojure compiler.
-Promoting this library eliminates the need for a dependency on old contrib.
+Supported options:
-### 2.29 Add support for running -main namespaces from clojure.main
+* `:elide-meta`: Have certain metadata elided during compilation. This
+should be set to a collection of keywords.
+* `:disable-locals-clearing`: Set to true to disable clearing. Useful for
+using a debugger.
-This patch allows clojure.main to accept an argument pointing to a namespace to look for a -main function in. This allows users to write -main functions that will work the same whether the code is AOT-compiled for use in an executable jar or just run from source.
+The main function of the Clojure compiler sets the
+`*compiler-options*` from properties prefixed by `clojure.compiler`,
+e.g.
-### 2.30 Set thread names on agent thread pools
+ java -Dclojure.compiler.elide-meta='[:doc :file :line]'
-It's a best practice to name the threads in an executor thread pool with a custom ThreadFactory so that the purpose of these threads is clear in thread dumps and other runtime operational tools.
+### 2.15 Improved Reporting of Invalid Characters in Unicode String Literals
-Patch causes thread names like:
+When the reader finds an invalid character in a Unicode string literal, it
+now reports the character instead of its numerical representation.
- clojure-agent-send-pool-%d (should be fixed # of threads)
- clojure-agent-send-off-pool-%d (will be added and removed over time)
+### 2.16 clojure.core/hash No Longer Relies on .hashCode
-### 2.31 Add docstring support to def
+`hash` no longer directly uses .hashCode() to return the hash of a Clojure
+data structure. It calls `clojure.lang.Util.hasheq`, which has its own implementation
+for Integer, Short, Byte, and Clojure collections. This ensures that the hash code
+returned is consistent with `=`.
-A def can now have a docstring between name and value.
+### 2.17 Java 7 Documentation
- (def foo "a foo" :foo)
+`*core-java-api*` will now return the URL for the Java 7 Javadoc when you are
+running Java 7.
-### 2.32 Comp function returns identity when called with zero arity
+### 2.18 loadLibrary Loads Library Using System ClassLoader
- (= (comp) identity)
- => true
+A static method, `loadLibrary`, was added to `clojure.lang.RT` to load a
+library using the system ClassLoader instead of Clojure's class loader.
-### 2.33 Type hints can be applied to arg vectors
+### 2.19 Java int is Boxed As java.lang.Integer
-You can hint different arities separately:
-
- (defn hinted
- (^String [])
- (^Integer [a])
- (^java.util.List [a & args]))
-
-This is preferred over hinting the function name. Hinting the function name is still allowed for backward compatibility, but will likely be deprecated in a future release.
-
-### 2.34 Binding Conveyance
-
-Clojure APIs that pass work off to other threads (e.g. send, send-off, pmap, future) now convey the dynamic bindings of the calling thread:
-
- (def ^:dynamic *num* 1)
- (binding [*num* 2] (future (println *num*)))
- ;; prints "2", not "1"
+Java `int`s are now boxed as `java.lang.Integer`s. See
+[the discussion on clojure-dev](https://groups.google.com/forum/#!msg/clojure/7-hARL5c1lI/ntnnOweEGfUJ)
+for more information.
## 3 Performance Enhancements
- * Code path for using vars is now much faster for the common case
- * Improved startup time
- * Fix performance on some numeric overloads
- See [CLJ-380](http://dev.clojure.org/jira/browse/CLJ-5) for more information
- * Promises are lock free
- * Functions only get metadata support code when metadata explicitly supplied
- * definterface/gen-interface accepts array type hints
- * inline nil?
- * inline bit-functions & math ops
- * inline n-ary min & max
- * PersistentQueue count is now O(1)
- * Intrinsics: unchecked math operators now emit bytecodes directly where possible
+* `(= char char)` is now optimized
+* `equiv` is inlined in variadic =
+* `toString` cached on keywords and symbols
## 4 Bug Fixes
-[Complete list of Tickets for 1.3 Release][ISSUES].
-
-[ISSUES]: http://dev.clojure.org/jira/secure/IssueNavigator.jspa?mode=hide&requestId=10052
-
- * [CLJ-8](http://dev.clojure.org/jira/browse/CLJ-8)
- detect and report cyclic load dependencies
- * Patch restore detection of cyclic load dependencies
-
- * [CLJ-31](http://dev.clojure.org/jira/browse/CLJ-31)
- compiler now correctly rejects attempts to recur across try
- (fn [x] (try (recur 1)))
- => CompilerException
-
- * [CLJ-286](http://dev.clojure.org/jira/browse/CLJ-286)
- \*out\* being used as java.io.PrintWriter
- * Patch fixes using Writer instead of PrintWriter
- * fix clojure.main to not assume that *err* is a PrintWriter
-
- * [CLJ-292](http://dev.clojure.org/jira/browse/CLJ-292)
- LazySeq.sval() nests RuntimeExceptions
- * Patch causes only the original RuntimeException to be thrown
-
- * [CLJ-390](http://dev.clojure.org/jira/browse/CLJ-390)
- sends from agent error-handlers should be allowed
- * Patch allows agent error-handler to send successfully
-
- * [CLJ-426](http://dev.clojure.org/jira/browse/CLJ-426)
- case should handle hash collision
- * There were situations where a hash collision would occur with case and an exception would be thrown. See [discussion](https://groups.google.com/d/topic/clojure/m4ZDWKSfmfo/discussion) for more details
-
- * [CLJ-430](http://dev.clojure.org/jira/browse/CLJ-430)
- clojure.java.io URL Coercion throws java.lang.ClassCastException
- * Patch correct exception to be thrown
-
- * [CLJ-432](http://dev.clojure.org/jira/browse/CLJ-432)
- deftype does not work if containing ns contains dashes
- * Patch munges namespaces with dashes properly
-
- * [CLJ-433](http://dev.clojure.org/jira/browse/CLJ-433)
- munge should not munge $ (which isJavaIdentifierPart), should munge ' (which is not)
-
- * [CLJ-435](http://dev.clojure.org/jira/browse/CLJ-435)
- stackoverflow exception in printing meta with :type
- * Patch fixes exception being thrown on certain type metadata
- (with-meta {:value 2} {:type Object})
- => No message. [Thrown class java.lang.StackOverflowError]
-
- * [CLJ-437](http://dev.clojure.org/jira/browse/CLJ-437)
- Bugs in clojure.set/subset? and superset? for sets with false/nil elements
- * Patch fixes failing on subset? and superset? for sets with false/nil elements
-
- * [CLJ-439](http://dev.clojure.org/jira/browse/CLJ-439)
- Automatic type translation from Integer to Long
- * Patch fixes increase coercion from Integer to Long
-
- * [CLJ-444](http://dev.clojure.org/jira/browse/CLJ-444)
- Infinite recursion in Keyword.intern leads to stack overflow
- * No more infinite recursion with patch
-
- * [CLJ-673](http://dev.clojure.org/jira/browse/CLJ-673)
- use system class loader when base loader is null
- * facilitates placing Clojure on bootclasspath
-
- * [CLJ-678](http://dev.clojure.org/jira/browse/CLJ-678)
- into-array should work with all primitive types
-
- * [CLJ-680](http://dev.clojure.org/jira/browse/CLJ-680)
- printing promises should not block
- * Patch allows printing of promises without blocking
-
- * [CLJ-682](http://dev.clojure.org/jira/browse/CLJ-682)
- cl-format: ~w throws an exception when not wrapped in a pretty-writer
- * Patch fixes the following bug in cl-format with ~w:
-
- * [CLJ-693](http://dev.clojure.org/jira/browse/CLJ-693)
- VerifyError with symbol metadata, macros, and defrecord
-
- * [CLJ-702](http://dev.clojure.org/jira/browse/CLJ-702)
- case gives NPE when used with nil
- * Patch allows nil to be used with case
-
- * [CLJ-734](http://dev.clojure.org/jira/browse/CLJ-734)
- starting scope of let bindings seems incorrect from jdi perspective
- * Patch fixes local variables table to have the correct code index for let bindings.
-
- * [CLJ-739](http://dev.clojure.org/jira/browse/CLJ-739)
- version.properties file is not closed
- * Patch properly closes version.properties file
-
- * [CLJ-751](http://dev.clojure.org/jira/browse/CLJ-751)
- cl-format: ~( throws an exception with an empty string
- * Patch fixes the following bug in cl-format when format is nil
- (cl-format nil "~:(~a~)" "")
- => NullPointerException
-
- * [CLJ-780](http://dev.clojure.org/jira/browse/CLJ-780)
- race condition in reference cache on Java 5
- * Map.Entry instances can have null values prior to Java 6. This patch provides a workaround.
-
- * floats were being boxed as Doubles, now they are boxed as Floats
-
- * several "holding onto head" fixes
- * Stop top-level defs from hanging onto the head of an expression that uses a lazy seq
- * Stop multimethods from holding onto heads of their arguments
-
-## 5 Modular Contrib
-
-In 1.3, the monolithic clojure-contrib.jar has been replaced by a modular system of contrib libraries, so that production systems can include only the code they actually need. This also allows individual contribs to have their own release cycles. Many contribs have moved forward by several point versions already. Documentation for updating applications to use the new contrib libraries is at http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
-
-Important Note: Many of the new modular contribs are compatible with both 1.2 and 1.3. This offers an incremental migration path: First, upgrade your contrib libraries while holding Clojure at 1.2, Then, in a separate step, upgrade to Clojure 1.3.
+* [CLJ-829](http://dev.clojure.org/jira/browse/CLJ-829)
+ Transient hashmaps mishandle hash collisions
+* [CLJ-773](http://dev.clojure.org/jira/browse/CLJ-773)
+ Macros that are expanded away still have their vars referenced in the emitted byte code
+* [CLJ-837](http://dev.clojure.org/jira/browse/CLJ-837)
+ java.lang.VerifyError when compiling deftype or defrecord with argument name starting with double underscore characters
+* [CLJ-369](http://dev.clojure.org/jira/browse/CLJ-369)
+ Check for invalid interface method names
+* [CLJ-845](http://dev.clojure.org/jira/browse/CLJ-845)
+ Unexpected interaction between protocol extension and namespaced method keyword/symbols
+ * Ignoring namespace portion of symbols used to name methods in extend-type and extend-protocol
+* [CLJ-852](http://dev.clojure.org/jira/browse/CLJ-852)
+ IllegalArgumentException thrown when defining a var whose value is calculated with a primitive fn
+* [CLJ-855](http://dev.clojure.org/jira/browse/CLJ-855)
+ catch receives a RuntimeException rather than the expected checked exception
+* [CLJ-876](http://dev.clojure.org/jira/browse/CLJ-876)
+ #^:dynamic vars declared in a nested form are not immediately dynamic
+* [CLJ-886](http://dev.clojure.org/jira/browse/CLJ-886)
+ java.io/do-copy can garble multibyte characters
+* [CLJ-895](http://dev.clojure.org/jira/browse/CLJ-895)
+ Collection.toArray implementations do not conform to Java API docs
+ * obey contract for toArray return type
+* [CLJ-898](http://dev.clojure.org/jira/browse/CLJ-898)
+ Agent sends consume heap
+ * Only capture a shallow copy of the current Frame in binding-conveyor-fn, so that sends in agent actions don't build infinite Frame stacks
+* [CLJ-928](http://dev.clojure.org/jira/browse/CLJ-928)
+ Instant literal for Date and Timestamp should print in UTC
+* [CLJ-931](http://dev.clojure.org/jira/browse/CLJ-933)
+ Syntactically broken clojure.test/are tests succeed
+* [CLJ-933](http://dev.clojure.org/jira/browse/CLJ-933)
+ Compiler warning on clojure.test-clojure.require-scratch
+
View
2  pom.xml
@@ -5,7 +5,7 @@
<artifactId>clojure</artifactId>
<name>clojure</name>
<packaging>jar</packaging>
- <version>1.4.0-master-SNAPSHOT</version>
+ <version>1.5.0-master-SNAPSHOT</version>
<url>http://clojure.org/</url>
<description>Clojure core environment and runtime library.</description>
View
15 src/clj/clojure/core.clj
@@ -6025,12 +6025,9 @@
items, returns val and f is not called."
{:added "1.0"}
([f coll]
- (if-let [s (seq coll)]
- (reduce f (first s) (next s))
- (f)))
+ (clojure.core.protocols/coll-reduce coll f))
([f val coll]
- (let [s (seq coll)]
- (clojure.core.protocols/internal-reduce s f val))))
+ (clojure.core.protocols/coll-reduce coll f val)))
(extend-protocol clojure.core.protocols/IKVReduce
;;slow path default
@@ -6621,11 +6618,11 @@
"Map from reader tag symbols to data reader Vars.
When Clojure starts, it searches for files named 'data_readers.clj'
- at the root of the classpath. Each such file must contain pairs of
- symbols, like this:
+ at the root of the classpath. Each such file must contain a literal
+ map of symbols, like this:
- foo/bar my.project.foo/bar
- foo/baz my.prjoect/baz
+ {foo/bar my.project.foo/bar
+ foo/baz my.project/baz}
The first symbol in each pair is a tag that will be recognized by
the Clojure reader. The second symbol in the pair is the
View
66 src/clj/clojure/core/protocols.clj
@@ -10,11 +10,73 @@
(set! *warn-on-reflection* true)
+(defprotocol CollReduce
+ "Protocol for collection types that can implement reduce faster than
+ first/next recursion. Called by clojure.core/reduce. Baseline
+ implementation defined in terms of Iterable."
+ (coll-reduce [coll f] [coll f val]))
+
(defprotocol InternalReduce
"Protocol for concrete seq types that can reduce themselves
faster than first/next recursion. Called by clojure.core/reduce."
(internal-reduce [seq f start]))
+(defn- seq-reduce
+ ([coll f]
+ (if-let [s (seq coll)]
+ (internal-reduce (next s) f (first s))
+ (f)))
+ ([coll f val]
+ (let [s (seq coll)]
+ (internal-reduce s f val))))
+
+(extend-protocol CollReduce
+ nil
+ (coll-reduce
+ ([coll f] (f))
+ ([coll f val] val))
+
+ Object
+ (coll-reduce
+ ([coll f] (seq-reduce coll f))
+ ([coll f val] (seq-reduce coll f val)))
+
+ ;;aseqs are iterable, masking internal-reducers
+ clojure.lang.ASeq
+ (coll-reduce
+ ([coll f] (seq-reduce coll f))
+ ([coll f val] (seq-reduce coll f val)))
+
+ ;;for range
+ clojure.lang.LazySeq
+ (coll-reduce
+ ([coll f] (seq-reduce coll f))
+ ([coll f val] (seq-reduce coll f val)))
+
+ ;;vector's chunked seq is faster than its iter
+ clojure.lang.PersistentVector
+ (coll-reduce
+ ([coll f] (seq-reduce coll f))
+ ([coll f val] (seq-reduce coll f val)))
+
+ Iterable
+ (coll-reduce
+ ([coll f]
+ (let [iter (.iterator coll)]
+ (if (.hasNext iter)
+ (loop [ret (.next iter)]
+ (if (.hasNext iter)
+ (recur (f ret (.next iter)))
+ ret))
+ (f))))
+ ([coll f val]
+ (let [iter (.iterator coll)]
+ (loop [ret val]
+ (if (.hasNext iter)
+ (recur (f ret (.next iter)))
+ ret)))))
+ )
+
(extend-protocol InternalReduce
nil
(internal-reduce
@@ -95,4 +157,8 @@
(emit-array-impls int long float double byte char boolean)
(defprotocol IKVReduce
+ "Protocol for concrete associative types that can reduce themselves
+ via a function of key and val faster than first/next recursion over map
+ entries. Called by clojure.core/reduce-kv, and has same
+ semantics (just different arg order)."
(kv-reduce [amap f init]))
View
1  src/clj/clojure/core_deftype.clj
@@ -205,6 +205,7 @@
(clojure.lang.MapEntry. k# v#))))
`(seq [this#] (seq (concat [~@(map #(list `new `clojure.lang.MapEntry (keyword %) %) base-fields)]
~'__extmap)))
+ `(iterator [this#] (clojure.lang.SeqIterator. (.seq this#)))
`(assoc [this# k# ~gs]
(condp identical? k#
~@(mapcat (fn [fld]

No commit comments for this range

Something went wrong with that request. Please try again.