All Versions
69
Latest Version
4.6
Avg Release Cycle
124 days
Latest Release
-

Changelog History
Page 5

  • v2.5 Changes

    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.

    (reduce-kv str "Hello " {:w \o :r \l :d \!})
    ;=> "Hello :rl:d!:wo"
    (reduce-kv str "Hello " [\w \o \r \l \d \!])
    ;=> "Hello 0w1o2r3l4d5!"
    
  • v2.4 Changes

    Clojure 1.6 provides new hashing algorithms for primitives and collections, accessible via IHashEq/hasheq (in Java) or the clojure.core/hash function (in Clojure). In general, these changes should be transparent to users, except hash codes used inside hashed ๐Ÿ‘ collections like maps and sets will have better properties.

    Hash codes returned by the Java .hashCode() method are unchanged and continue to match Java behavior or conform to the Java specification as appropriate.

    Any collections implementing IHashEq or wishing to interoperate with Clojure collections should conform to the hashing algorithms specified in http://clojure.org/data_structures#hash and use the new function mix-collection-hash for the final mixing operation. Alternatively, you may call the helper functions hash-ordered-coll and hash-unordered-coll.

    Any details of the current hashing algorithm not specified on that page should be considered subject to future change.

    Related tickets for dev and regressions:

    • CLJ-1328 Make several Clojure tests independent of ordering
    • CLJ-1331 Update primitive vectors to use Murmur3 hash
    • CLJ-1335 Update hash for empty PersistentList and LazySeq
    • CLJ-1336 Make hashing mixing functions available in Clojure
    • CLJ-1338 Make Murmur3 class public
    • CLJ-1344 Update mapHasheq to call Murmur3 algorithm
    • CLJ-1348 Add hash-ordered-coll and hash-unordered-coll
    • CLJ-1355 Restore cached hashCode for Symbol and (uncached) hashCode for Keyword
    • CLJ-1365 Add type hints for new collection hash functions
  • v2.3 Changes

    • ๐Ÿ‘Œ Improved update-in performance
    • โšก๏ธ Optimized seq & destructuring
    • CLJ-2210 Cache class derivation in compiler to improve compiler performance
    • CLJ-2188 slurp - mark return type as String
    • CLJ-2070 clojure.core/delay - improve performance
    • CLJ-1917 Reducing seq over string should call String/length outside of loop
    • CLJ-1901 amap - should call alength only once
    • CLJ-1224 Record instances now cache hasheq and hashCode like maps
    • CLJ-99 min-key and max-key - evaluate k on each arg at most once
  • v2.2 Changes

    ๐Ÿ‘ Reader Conditionals are a new capability to support portable code that can run on multiple Clojure platforms with only small changes. In ๐Ÿ‘ particular, this feature aims to support the increasingly common case of libraries targeting both Clojure and ClojureScript.

    Code intended to be common across multiple platforms should use a new ๐Ÿ‘Œ supported file extension: ".cljc". When requested to load a namespace, the platform-specific file extension (.clj, .cljs) will be checked prior to .cljc.

    A new reader form can be used to specify "reader conditional" code in cljc files (and only cljc files). Each platform defines a feature identifying the platform (:clj, :cljs, :cljr). The reader conditional specifies code that is read conditionally based on the feature. The REPL also allows reader conditionals.

    Form #? takes a list of alternating feature and expression. These are checked like cond and the selected expression is read and returned. Other branches are read but skipped. If no branch is selected, the reader reads nothing (not nil, but literally as if reading no form). An optional 0๏ธโƒฃ :default branch can be used as a fallthrough.

    0๏ธโƒฃ Reader conditional with 2 features and a default:

    #?(:clj     Double/NaN
       :cljs    js/NaN
       :default nil)
    

    There is also a reader conditional splicing form. The evaluated expression should be sequential and will be spliced into the surrounded code, similar to unquote-splicing.

    For example:

    [1 2 #?@(:clj [3 4] :cljs [5 6])]

    This form would read as [1 2 3 4] on Clojure, [1 2 5 6] on ClojureScript, and [1 2] on any other platform. Splicing is not allowed at the top level.

    โž• Additionally, the reader can now be invoked with options for the features 0๏ธโƒฃ to use and how to interpret reader conditionals. By default, reader conditionals are not allowed, but that can be turned on, or a "preserve" mode can be used to preserve all branches (most likely useful for tooling or source transforms).

    In the preserve mode, the reader conditional itself and any tagged literals within the unselected branches are returned as tagged literal data.

    ๐Ÿ‘€ For more information, see: http://dev.clojure.org/display/design/Reader+Conditionals

  • v2.1.2 Changes

    ๐Ÿ‘ Clojure supports literals for UUIDs in the form #uuid "uuid-string". These ๐Ÿ“œ literals are parsed as java.util.UUIDs.

  • v2.1.1 Changes

    ๐Ÿ‘ Clojure supports literals for instants in the form ๐Ÿ“œ #inst "yyyy-mm-ddThh:mm:ss.fff+hh:mm". These literals are parsed as java.util.Dates 0๏ธโƒฃ by default. They can be parsed as java.util.Calendars or java.util.Timestamps by binding *data-readers* to use clojure.instant/read-instant-calendar or clojure.instant/read-instant-timestamp.

    (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
    
    (binding [*data-readers* {'inst read-instant-timestamp}]
      (= java.util.Timestamp (class (read-string instant))))
    ;=> true
    
  • v2.1 Changes

    Transducers is a new way to decouple algorithmic transformations from their application in different contexts. Transducers are functions that transform ๐Ÿ— reducing functions to build up a "recipe" for transformation.

    ๐Ÿ‘€ Also see: http://clojure.org/transducers

    Many existing sequence functions now have a new arity (one fewer argument than before). This arity will return a transducer that represents the same logic but is independent of lazy sequence processing. Functions included are:

    • map
    • mapcat
    • filter
    • โœ‚ remove
    • take
    • take-while
    • โฌ‡๏ธ drop
    • โฌ‡๏ธ drop-while
    • take-nth
    • replace
    • partition-by
    • partition-all
    • keep
    • keep-indexed
    • map-indexed
    • distinct
    • interpose

    โž• Additionally some new transducer functions have been added:

    • cat - concatenates the contents of each input
    • ๐Ÿšš dedupe - removes consecutive duplicated values
    • random-sample - returns items from coll with random probability

    And this function can be used to make completing transforms:

    • completing

    There are also several new or modified functions that can be used to apply transducers in different ways:

    • sequence - takes a transformation and a coll and produces a lazy seq
    • transduce - reduce with a transformation (eager)
    • eduction - returns a reducible/iterable of applications of the transducer to items in coll. Applications are re-performed with every reduce/iterator.

    ๐Ÿ‘ There have been a number of internal changes to support transducers:

    • volatiles - there are a new set of functions (volatile!, vswap!, vreset!, volatile?) to create and use volatile "boxes" to hold state in stateful transducers. Volatiles are faster than atoms but give up atomicity guarantees so should only be used with thread isolation.
    • ๐Ÿ‘ array iterators - added support for iterators over arrays
    • conj can be used as a reducing function and will conj to []

    Some related issues addressed during development:

  • v1.11.0 Changes

    1 Compatibility

  • v1.10.3 Changes

    โช 1 Changes reverted

    • CLJ-2564 Improve error message for case

    ๐Ÿ›  2 Fixes

    • CLJ-2453 Enable reader conditionals in Clojure prepl
  • v1.10.2 Changes

    1 Dependencies

    โšก๏ธ Updated dependencies:

    • spec.alpha dependency to 0.2.194 - changes
    • core.specs.alpha dependency to 0.2.56 - changes

    ๐Ÿ›  2 Fixes