Permalink
Browse files

Update a few patches, add a few.

  • Loading branch information...
1 parent 19063b6 commit 2202804e1f5167a9e349e0685c8fdda16decce48 @jafingerhut committed Mar 27, 2012
@@ -0,0 +1,48 @@
+From 67bb2c4acffd6092b78ed0164e33ddc7c15dd78c Mon Sep 17 00:00:00 2001
+From: Tassilo Horn <tassilo@member.fsf.org>
+Date: Thu, 22 Mar 2012 17:15:13 +0100
+Subject: [PATCH] Implement CLJ-207: :let as first for binding form.
+
+---
+ src/clj/clojure/core.clj | 7 +++++++
+ test/clojure/test_clojure/for.clj | 6 ++++++
+ 2 files changed, 13 insertions(+), 0 deletions(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 9cf45e6..cecbee0 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -4096,6 +4096,13 @@
+ (conj (pop groups) (conj (peek groups) [k v]))
+ (conj groups [k v])))
+ [] (partition 2 seq-exprs)))
++ ;; Special case :let as first item: Transform [:let [a x, b y] more] to
++ ;; [a [x], b [y] more].
++ seq-exprs (if (= :let (first seq-exprs))
++ (vec (concat (mapcat (fn [[lv le]] [lv [le]])
++ (partition 2 (second seq-exprs)))
++ (next (next seq-exprs))))
++ seq-exprs)
+ err (fn [& msg] (throw (IllegalArgumentException. ^String (apply str msg))))
+ emit-bind (fn emit-bind [[[bind expr & mod-pairs]
+ & [[_ next-expr] :as next-groups]]]
+diff --git a/test/clojure/test_clojure/for.clj b/test/clojure/test_clojure/for.clj
+index 6d9dc59..291ad31 100644
+--- a/test/clojure/test_clojure/for.clj
++++ b/test/clojure/test_clojure/for.clj
+@@ -122,6 +122,12 @@
+ (is (= (for [x (range 6) :let [y (rem x 2)] :when (even? y) z [8 9]] [x z])
+ '([0 8] [0 9] [2 8] [2 9] [4 8] [4 9]))))
+
++(deftest-both Let-in-Front-Position
++ (is (= (for [:let [a 1, b 2], c [3 4]] [a b c])
++ '([1 2 3] [1 2 4])))
++ (is (= (for [:let [a [1 2]], b [3 4 5]] (conj a b))
++ '([1 2 3] [1 2 4] [1 2 5]))))
++
+ ; :while must skip all subsequent chunks as well as the remainder of
+ ; the current chunk:
+ (deftest-both Chunked-While
+--
+1.7.8.5
+
@@ -0,0 +1,32 @@
+From 20dc6c25d014813da3f6662acceca26465fbe02e Mon Sep 17 00:00:00 2001
+From: Alan Malloy <alan@malloys.org>
+Date: Tue, 10 Jan 2012 15:15:26 -0800
+Subject: [PATCH] Print metadata and anonymous classes better
+
+---
+ src/clj/clojure/core_print.clj | 8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/clj/clojure/core_print.clj b/src/clj/clojure/core_print.clj
+index 641c707..31efd35 100644
+--- a/src/clj/clojure/core_print.clj
++++ b/src/clj/clojure/core_print.clj
+@@ -88,9 +88,13 @@
+ (.write w ")"))
+
+ (defmethod print-method Object [o, ^Writer w]
++ (when (instance? clojure.lang.IMeta o)
++ (print-meta o w))
+ (.write w "#<")
+- (.write w (.getSimpleName (class o)))
+- (.write w " ")
++ (let [name (.getSimpleName (class o))]
++ (when (seq name) ;; anonymous classes have a simple name of ""
++ (.write w name)
++ (.write w " ")))
+ (.write w (str o))
+ (.write w ">"))
+
+--
+1.7.4.1
+
@@ -0,0 +1,51 @@
+From 2e91b67d18972e34653980c477cea1bafa54c8e7 Mon Sep 17 00:00:00 2001
+From: Meikel Brandmeyer <mb@kotka.de>
+Date: Mon, 26 Mar 2012 16:38:33 -0700
+Subject: [PATCH] Avoid duplicate key check in destructuring
+
+---
+ src/clj/clojure/core.clj | 2 +-
+ test/clojure/test_clojure/special.clj | 10 ++++++++++
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 9cf45e6..8877df2 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -3927,7 +3927,7 @@
+ (let [gmap (or (:as b) (gensym "map__"))
+ defaults (:or b)]
+ (loop [ret (-> bvec (conj gmap) (conj v)
+- (conj gmap) (conj `(if (seq? ~gmap) (apply hash-map ~gmap) ~gmap)))
++ (conj gmap) (conj `(if (seq? ~gmap) (#'clojure.core/into1 {} (map vec (partition 2 ~gmap))) ~gmap)))
+ bes (reduce1
+ (fn [bes entry]
+ (reduce1 #(assoc %1 %2 ((val entry) %2))
+diff --git a/test/clojure/test_clojure/special.clj b/test/clojure/test_clojure/special.clj
+index f3a8164..5e38863 100644
+--- a/test/clojure/test_clojure/special.clj
++++ b/test/clojure/test_clojure/special.clj
+@@ -13,6 +13,7 @@
+ ;;
+
+ (ns clojure.test-clojure.special
++ (:import [java.util Locale])
+ (:use clojure.test))
+
+ ; http://clojure.org/special_forms
+@@ -22,3 +23,12 @@
+ ; var
+ ; fn
+
++(deftest test-multiple-identical-keys-in-destructuring
++ (is (= " 3.14"
++ (let [number-to-string (fn [& {fmt :format locale :locale}]
++ (fn [v]
++ (String/format locale fmt (to-array [v]))))
++ double-to-string (fn [& options]
++ (apply number-to-string :format "%f" options))
++ us-number (double-to-string :format "% 3.2f" :locale Locale/US)]
++ (us-number 3.14159)))))
+--
+1.7.9.2
+
@@ -1,13 +1,13 @@
-From f0ee736d5ff0fe7eba08df1d5352204d009d2f9e Mon Sep 17 00:00:00 2001
+From 6b2bcdd022fc13faaab7d75223bbd5a4082db7de Mon Sep 17 00:00:00 2001
From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
-Date: Mon, 13 Feb 2012 19:42:35 -0800
-Subject: [PATCH] Fixes for CLJ-768 and other problems found with cl-format ~f
- directive
+Date: Tue, 27 Mar 2012 08:56:23 -0700
+Subject: [PATCH 12/12] Fixes for CLJ-768 and other problems found with
+ cl-format ~f directive
Without the changes to cl_format.clj, 46 of the 72 new unit tests
added to test_cl_format.clj fail.
---
- src/clj/clojure/pprint/cl_format.clj | 41 +++++++++--
+ src/clj/clojure/pprint/cl_format.clj | 41 ++++++++---
.../clojure/test_clojure/pprint/test_cl_format.clj | 72 ++++++++++++++++++++
2 files changed, 105 insertions(+), 8 deletions(-)
@@ -85,7 +85,7 @@ index 74cd33b..246b65d 100644
(if w
(let [len (count fixed-repr)
diff --git a/test/clojure/test_clojure/pprint/test_cl_format.clj b/test/clojure/test_clojure/pprint/test_cl_format.clj
-index eda2305..990d3d5 100644
+index 62fa685..b754cb0 100644
--- a/test/clojure/test_clojure/pprint/test_cl_format.clj
+++ b/test/clojure/test_clojure/pprint/test_cl_format.clj
@@ -205,11 +205,83 @@
@@ -169,9 +169,9 @@ index eda2305..990d3d5 100644
+ (cl-format nil "~6,2f" -111.11111) "-111.11"
+ (cl-format nil "~6,3f" -111.11111) "-111.111"
+ (cl-format nil "~8,5f" -111.11111) "-111.11111"
- (cl-format nil "~12,10f" 1.00000000074) "1.0000000007"
- (cl-format nil "~12,10f" 1.00000000076) "1.0000000008"
- (cl-format nil "~13,10f" -1.00000000074) "-1.0000000007"
+ (cl-format nil "~12,10f" 1.23456789014) "1.2345678901"
+ (cl-format nil "~12,10f" 1.23456789016) "1.2345678902"
+ (cl-format nil "~13,10f" -1.23456789014) "-1.2345678901"
--
-1.7.7.4
+1.7.9.2
@@ -1,25 +0,0 @@
-From 97ecb105f06914420558456763518c91399ac856 Mon Sep 17 00:00:00 2001
-From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
-Date: Fri, 24 Feb 2012 09:16:20 -0800
-Subject: [PATCH] Remove spurious & in doc string for resolve
-
----
- src/clj/clojure/core.clj | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
-index 1dc12c3..a2694d7 100644
---- a/src/clj/clojure/core.clj
-+++ b/src/clj/clojure/core.clj
-@@ -3883,7 +3883,7 @@
- (clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))))
-
- (defn resolve
-- "same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
-+ "same as (ns-resolve *ns* symbol) or (ns-resolve *ns* env symbol)"
- {:added "1.0"
- :static true}
- ([sym] (ns-resolve *ns* sym))
---
-1.7.3.4
-
@@ -1,11 +1,12 @@
-From 6d00a521152fa8635d5b6a74277681b475b1095f Mon Sep 17 00:00:00 2001
-From: Vyacheslav Dimitrov <vyacheslav.dimitrov@gmail.com>
-Date: Sun, 12 Feb 2012 00:21:16 -0800
-Subject: [PATCH] Fix for bug CLJ-881.
+From 45e7d1e8f812c57302d375ebf735c75baa802019 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Mon, 26 Mar 2012 14:58:56 -0700
+Subject: [PATCH] CLJ-881: exception when cl-format is given some ~f
+ directive/value combinations
---
- src/clj/clojure/pprint/cl_format.clj | 22 +++++++++++++++----
- .../clojure/test_clojure/pprint/test_cl_format.clj | 4 +++
+ src/clj/clojure/pprint/cl_format.clj | 22 +++++++++++++++-----
+ .../clojure/test_clojure/pprint/test_cl_format.clj | 4 ++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/clj/clojure/pprint/cl_format.clj b/src/clj/clojure/pprint/cl_format.clj
@@ -49,20 +50,20 @@ index ef5c981..74cd33b 100644
[round-up-result e1 expanded])
[result e1 false]))
diff --git a/test/clojure/test_clojure/pprint/test_cl_format.clj b/test/clojure/test_clojure/pprint/test_cl_format.clj
-index 8a95104..eda2305 100644
+index 8a95104..62fa685 100644
--- a/test/clojure/test_clojure/pprint/test_cl_format.clj
+++ b/test/clojure/test_clojure/pprint/test_cl_format.clj
@@ -210,6 +210,10 @@
(cl-format nil "~3f" -1) "-1."
(cl-format nil "~4f" -1) "-1.0"
(cl-format nil "~8f" -1) " -1.0"
-+ (cl-format nil "~12,10f" 1.00000000074) "1.0000000007"
-+ (cl-format nil "~12,10f" 1.00000000076) "1.0000000008"
-+ (cl-format nil "~13,10f" -1.00000000074) "-1.0000000007"
-+ (cl-format nil "~13,10f" -1.00000000076) "-1.0000000008"
++ (cl-format nil "~12,10f" 1.23456789014) "1.2345678901"
++ (cl-format nil "~12,10f" 1.23456789016) "1.2345678902"
++ (cl-format nil "~13,10f" -1.23456789014) "-1.2345678901"
++ (cl-format nil "~13,10f" -1.23456789016) "-1.2345678902"
(cl-format nil "~1,1f" 0.1) ".1")
(simple-tests ampersand-tests
--
-1.7.7.4
+1.7.9.2
@@ -0,0 +1,41 @@
+From 02c096f6ecf6a02120cd82214a4162a1da178731 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Mon, 26 Mar 2012 15:29:04 -0700
+Subject: [PATCH] Clarify doc strings of sort and sort-by: they will modify
+ Java array arguments
+
+---
+ src/clj/clojure/core.clj | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 9cf45e6..d27c3dd 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -2688,8 +2688,9 @@
+
+ (defn sort
+ "Returns a sorted sequence of the items in coll. If no comparator is
+- supplied, uses compare. comparator must
+- implement java.util.Comparator."
++ supplied, uses compare. comparator must implement
++ java.util.Comparator. If coll is a Java array, it will be modified.
++ To avoid this, sort a copy of the array."
+ {:added "1.0"
+ :static true}
+ ([coll]
+@@ -2704,8 +2705,9 @@
+ (defn sort-by
+ "Returns a sorted sequence of the items in coll, where the sort
+ order is determined by comparing (keyfn item). If no comparator is
+- supplied, uses compare. comparator must
+- implement java.util.Comparator."
++ supplied, uses compare. comparator must implement
++ java.util.Comparator. If coll is a Java array, it will be modified.
++ To avoid this, sort a copy of the array."
+ {:added "1.0"
+ :static true}
+ ([keyfn coll]
+--
+1.7.9.2
+
@@ -1,30 +0,0 @@
-From b0316505395a2f0efbb4906e78396e54a996ca54 Mon Sep 17 00:00:00 2001
-From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
-Date: Fri, 24 Feb 2012 18:30:17 -0800
-Subject: [PATCH] Document that vec can alias mutable collections passed to it.
-
----
- src/clj/clojure/core.clj | 7 ++++++-
- 1 files changed, 6 insertions(+), 1 deletions(-)
-
-diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
-index 1dc12c3..88faf83 100644
---- a/src/clj/clojure/core.clj
-+++ b/src/clj/clojure/core.clj
-@@ -338,7 +338,12 @@
- (. clojure.lang.LazilyPersistentVector (create (cons a (cons b (cons c (cons d args))))))))
-
- (defn vec
-- "Creates a new vector containing the contents of coll."
-+ "Creates a new vector containing the contents of coll. If coll is
-+ mutable, e.g. a Java array, the new vector and coll may share
-+ memory, and modifying coll could modify the contents of the vector.
-+ Either copy coll first (e.g. aclone for Java arrays), or never
-+ modify coll again (e.g. it is a temporary used only for creating
-+ the vector)."
- {:added "1.0"
- :static true}
- ([coll]
---
-1.7.3.4
-
@@ -0,0 +1,28 @@
+From f1a42c119ef12a900a6340ad4dfc5ca2a1cb65f2 Mon Sep 17 00:00:00 2001
+From: Andy Fingerhut <andy_fingerhut@alum.wustl.edu>
+Date: Mon, 26 Mar 2012 15:13:27 -0700
+Subject: [PATCH] Document that vec can alias Java arrays passed to it.
+
+---
+ src/clj/clojure/core.clj | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 9cf45e6..fb979ce 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -338,7 +338,10 @@
+ (. clojure.lang.LazilyPersistentVector (create (cons a (cons b (cons c (cons d args))))))))
+
+ (defn vec
+- "Creates a new vector containing the contents of coll."
++ "Creates a new vector containing the contents of coll. If coll is a
++Java array the returned vector aliases it and its contents will change
++if the Java array is modified. To avoid this, call vec on a copy of
++the array."
+ {:added "1.0"
+ :static true}
+ ([coll]
+--
+1.7.9.2
+
View
@@ -0,0 +1,25 @@
+From f35b53516c735a5165f761b6efef4c1ebbca862a Mon Sep 17 00:00:00 2001
+From: Jozef Wagner <jozef.wagner@gmail.com>
+Date: Sun, 5 Feb 2012 14:01:07 +0100
+Subject: [PATCH] fixed rand-nth
+
+---
+ src/clj/clojure/core.clj | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
+index 8967bee..a5a70eb 100644
+--- a/src/clj/clojure/core.clj
++++ b/src/clj/clojure/core.clj
+@@ -6339,7 +6339,7 @@
+ {:added "1.2"
+ :static true}
+ [coll]
+- (nth coll (rand-int (count coll))))
++ (nth coll (rand-int (count coll)) nil))
+
+ (defn partition-all
+ "Returns a lazy sequence of lists like partition, but may include
+--
+1.7.1
+
Oops, something went wrong.

0 comments on commit 2202804

Please sign in to comment.